# Thread: Different ways of calculating pi

1. Originally Posted by TriKri
That random number thing is interesting, cause I don't understand how $\displaystyle \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 $\displaystyle [1, \infty)$ has this chance of not sharing any prime factor: $\displaystyle \prod_{p\text{ prime}} 1 - \frac{1}{p^2}$ because the chance is $\displaystyle \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 $\displaystyle \frac{1}{p^2}$. For a and b to not share prime factor p the chance is $\displaystyle 1 - \frac{1}{p^2}$. And for a and b to not share any of the primes as a prime factor the chance is $\displaystyle \prod_{p\text{ prime}} 1 - \frac{1}{p^2}$. Though I have no idea how to connect that formula with $\displaystyle \pi$.
This is the infamous "Euler-Product Formula" that started the entire Riemann hypothesis thing being connected to prime numbers.

The infinite product in this case is the same as the infinite sum of all integral square, namely the zeta function evaluated at 2.
Thus, (and I think you meant this)
$\displaystyle \prod _p(1-p^{-2})^{-1}=\zeta (2)=\frac{\pi^2}{6}$.
Hence, pi appears in this expression.

2. Originally Posted by ThePerfectHacker
I have a question on this. When I first saw this I found it really interesting that $\displaystyle \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 $\displaystyle \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 $\displaystyle \pi$ is more elegant but I win this competition because mine is more efficient.
I'm not looking for efficiency I looking for Mad Scientists/Mathemeticians
methods, so I prefer Bob Matthews' and Buffon's methods, so we both win

RonL

3. Originally Posted by ThePerfectHacker
Here is an infinite series developed by Ramanjuan.
It has a collasol rate of convergence,
$\displaystyle \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.
Here's my own formula, not nearly as effective (in fact it's reasonably slow) and pretty ugly but how many pi formulas have you made

And I don't think I'm writing the "sum" part correctly

$\displaystyle \pi=2\cdot\sum_{a\to n}^{n\to \infty}\frac{\sqrt{2\left(n^2-a^2+a-\sqrt{a^2\left(a-1\right)^2+n^2\left(n^2+2a(1-a)-1\right)}\right)}}{n}$

4. Originally Posted by Quick
Here's my own formula, not nearly as effective (in fact it's reasonably slow) and pretty ugly but how many pi formulas have you made

And I don't think I'm writing the "sum" part correctly

$\displaystyle \pi=2\cdot\sum_{a\to n}^{n\to \infty}\frac{\sqrt{2\left(n^2-a^2+a-\sqrt{a^2\left(a-1\right)^2+n^2\left(n^2+2a(1-a)-1\right)}\right)}}{n}$
just to clarify.

$\displaystyle n\to \infty$ means that the closer n gets to infinity, the more accurate the number.

$\displaystyle a\to n$ means you add up every integer less than or equal to n.

After 100 terms, the series spits out the number: 3.14129

5. Originally Posted by Quick
but how many pi formulas have you made
I made one. The most obvious one based on area below a semi-circle.

6. Originally Posted by Quick
Here's my own formula, not nearly as effective (in fact it's reasonably slow) and pretty ugly but how many pi formulas have you made

And I don't think I'm writing the "sum" part correctly

$\displaystyle \pi=2\cdot\sum_{a\to n}^{n\to \infty}\frac{\sqrt{2\left(n^2-a^2+a-\sqrt{a^2\left(a-1\right)^2+n^2\left(n^2+2a(1-a)-1\right)}\right)}}{n}$
I believe you are looking for:
$\displaystyle \pi=\lim_{n \to \infty}2\cdot\sum_{a = 0}^n \frac{\sqrt{2\left(n^2-a^2+a-\sqrt{a^2\left(a-1\right)^2+n^2\left(n^2+2a(1-a)-1\right)}\right)}}{n}$

And where the heck does this monstrosity come from?

-Dan

7. Originally Posted by topsquark
I believe you are looking for:
$\displaystyle \pi=\lim_{n \to \infty}2\cdot\sum_{a = 0}^n \frac{\sqrt{2\left(n^2-a^2+a-\sqrt{a^2\left(a-1\right)^2+n^2\left(n^2+2a(1-a)-1\right)}\right)}}{n}$

And where the heck does this monstrosity come from?

-Dan
Well this "monstrosity" was a failed attempt at a function

But it's derived from measuring a quarter of the perimeter of an oddly shaped polygon inscribed in a unit circle

I must say that if you take away the equal sign noone (not even me) would guess that this thing is even remotely related to pi

8. Here is another method I came up with when I was Quick's age.
Using the Polygonal method (just like Quick used).
$\displaystyle \lim_{n\to \infty} n\sin \left( \frac{180^o}{n} \right)=\pi$

9. Originally Posted by ThePerfectHacker
Here is another method I came up with when I was Quick's age.
Using the Polygonal method (just like Quick used).
$\displaystyle \lim_{n\to \infty} n\sin \left( \frac{180^o}{n} \right)=\pi$
I did that to (remember my quick's quick question?)

Except I thought back and realized that sin might use pi to get the answer

That's the whole reason for this gigantic new one.

10. Originally Posted by Qiuck
$\displaystyle \lim_{n \to \infty}2\cdot\sum_{a = 0}^n \frac{\sqrt{2\left(n^2-a^2+a-\sqrt{a^2\left(a-1\right)^2+n^2\left(n^2+2a(1-a)-1\right)}\right)}}{n}=\pi$
What does it do? I'm having a hard time following it.

I can see that it is equivalent to

$\displaystyle \lim_{n \to \infty}\frac{\sqrt{8}}{n}\cdot\sum_{a = 0}^n \sqrt{n^2-a^2+a-\sqrt{a^2\left(a-1\right)^2+n^2(n^2+2a(1-a)-1)}}=\pi$

but I don't know how that's supposed to help

11. Originally Posted by TriKri
What does it do? I'm having a hard time following it.

I can see that it is equivalent to

$\displaystyle \lim_{n \to \infty}\frac{\sqrt{8}}{n}\cdot\sum_{a = 0}^n \sqrt{n^2-a^2+a-\sqrt{a^2\left(a-1\right)^2+n^2(n^2+2a(1-a)-1)}}=\pi$

but I don't know how that's supposed to help
I've rewritten it (so that it looks better) to:

$\displaystyle \lim_{n\to\infty}\frac{\sqrt8}{n}\cdot\sum_{a=0}^n \sqrt{n^2-a^2+a-\sqrt{a^2\left(a-1\right)^2+2an^2(1-a)+n^2(n^2-1)}}=\pi$

although it still looks pretty ugly

If you are asking how it's derived, I can easily show you

12. Originally Posted by Quick
I've rewritten it (so that it looks better) to:

$\displaystyle \lim_{n\to\infty}\frac{\sqrt8}{n}\cdot\sum_{a=0}^n \sqrt{n^2-a^2+a-\sqrt{a^2\left(a-1\right)^2+2an^2(1-a)+n^2(n^2-1)}}=\pi$

although it still looks pretty ugly

If you are asking how it's derived, I can easily show you
I'm having a weird problem, hopefully with MSexcel

after 100 terms, excel gives: 3.141299

After 200 however, excel gives: 3.194243

The way I set up the equation, it should never get above pi...

Can anyone verify excels answer (with mathematica or something)

If it's my equation, then I'll post the method for you guys to see what's wrong (I've gone over the work several times)

13. > If you are asking how it's derived, I can easily show you

Yes, that's what I meant.

14. Originally Posted by TriKri
> If you are asking how it's derived, I can easily show you

Yes, that's what I meant.
I hope you have a good imagination...

Consider a unit circle surrounding the origin, it's equation is $\displaystyle y^2=1-x^2$

Now my method only uses the first quadrant, so forget all the other ones

First, put $\displaystyle n$ equally spaced points along the x-axis from 0 to 1.

Now draw vertical lines from the points.

Connect the intersections of the lines and the circle to each other (you'll get a quarter of an oddly shaped polygon)

So try finding the total of those measurements.

To do that you must first solve for the change in y (which I call $\displaystyle \Delta y$ for each increment.

Consider the vertical line at point $\displaystyle a$, it intersects the circle at the y value: $\displaystyle y^2=1-x^2\Longrightarrow y=\sqrt{1-\left(\frac{a}{n}\right)^2}=\sqrt{\frac{n^2}{n^2}-\frac{a^2}{n^2}}=\sqrt{\frac{n^2-a^2}{n^2}}$

So then: $\displaystyle \Delta y=\sqrt{\frac{n^2-a^2}{n^2}}-\sqrt{\frac{n^2-(a-1)^2}{n^2}}$

Then: $\displaystyle \Delta y=\sqrt{\frac{n^2-a^2}{n^2}}-\sqrt{\frac{n^2-(a^2-2a+1)}{n^2}}$

Thus: $\displaystyle \Delta y^2=\frac{n^2-a^2}{n^2}+\frac{n^2-(a^2-2a+1)}{n^2}-2\sqrt{\frac{n^2-a^2}{n^2}}\sqrt{\frac{n^2-(a^2-2a+1)}{n^2}}$

Working through you'll eventually get: $\displaystyle \Delta y^2=\frac{2n^2-2a^2+2a-1-2\sqrt{a^2\left(a-1\right)^2+n^2\left(n^2+2a(1-a)-1\right)}}{n^2}$

Now the value of the hypotenuse of the triangle with $\displaystyle \Delta y$ as the height is: $\displaystyle \sqrt{\frac{2n^2-2a^2+2a-1-2\sqrt{a^2\left(a-1\right)^2+n^2\left(n^2+2a(1-a)-1\right)}}{n^2}+\frac{1}{n^2}}$

And then solve...

Can you do it from here? It wasn't a very good explanation...

15. I dont get this ... as far as I can see, you calculate $\displaystyle y'$ from the equation $\displaystyle y = \sqrt{1-x^2}$, to put an integral on $\displaystyle y'$, to get ... pi? How is that...

Isn't it simpler just integrating $\displaystyle y$ directly:

$\displaystyle \sum_{a=0}^n \frac{\sqrt{1-\left(\displaystyle\frac{a}{n}\right)^2}}{n}\ =\ \frac{1}{n}\sum_{a=0}^n \sqrt{\frac{n^2-a^2}{n^2}}\ = \ \frac{1}{n^2}\sum_{a=0}^n \sqrt{n^2-a^2}$

And one thing, I spoted that you set $\displaystyle \Delta y = \sqrt{\Delta y^2}$, that's equal to $\displaystyle |\Delta y|$ for real numbers $\displaystyle \Delta y$.
Note that $\displaystyle \sqrt{\frac{n^2-a^2}{n^2}}-\sqrt{\frac{n^2-(a-1)^2}{n^2}}\ =\$$\displaystyle -\sqrt{\frac{2n^2-2a^2+2a-1-2\sqrt{a^2\left(a-1\right)^2+n^2\left(n^2+2a(1-a)-1\right)}}{n^2}+\frac{1}{n^2}}$

Page 2 of 3 First 123 Last