Re: A Formula for Pi
- From: rob@xxxxxxxxxxxxxx (Rob Johnson)
- Date: Mon, 23 Jun 2008 10:50:40 GMT
In article <ef3600bd-5d9c-41d4-9442-f4703d45ba38@xxxxxxxxxxxxxxxxxxxxxxxxxx>,
Mensanator <mensanator@xxxxxxx> wrote:
On Jun 22, 7:29 pm, r...@xxxxxxxxxxxxxx (Rob Johnson) wrote:
In article <2e23fae6-a30d-49d8-9520-62d16cecc...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Mensanator <mensana...@xxxxxxx> wrote:
On Jun 22, 8:48 am, r...@xxxxxxxxxxxxxx (Rob Johnson) wrote:
In article <rubrum-29BD9A.21370621062...@xxxxxxxxxxxxxxxxxxxxx>,
Michael Press <rub...@xxxxxxxxxxx> wrote:
In article
<41c3a2f3-d399-42f6-b21d-ce897b6ba...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Mensanator <mensana...@xxxxxxx> wrote:
On Jun 20, 2:35 pm, r...@xxxxxxxxxxxxxx (Rob Johnson) wrote:
In article <4f348778-0c41-45e4-bb51-9fcc3dca9...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Mensanator <mensana...@xxxxxxx> wrote:
On Jun 20, 10:57 am, Maury Barbato <mauriziobarb...@xxxxxxxx> wrote:
Jose Carlos Santos wrote:
On 20-06-2008 7:16, Maury Barbato wrote:
I found in the book "The Penguin Dictionary of
Curious and Interesting Numbers" by Wells the
following formula involving pi
(pi - 3)/4
= sum_{k=1 to infty}[(-1)^(k+1)]/[2k*(2k+1)*(2k+2)]
Is there anybody who knows a proof of thiswonderful
series?
It's a very very beautiful formula!
Be that as it may, how fast does it converge?
How many terms do I have to sum to get 100 decimal
place accuracy?
He never claimed that it was an efficient way to compute pi,
I didn't say he claimed it was efficient. I'm _asking_
whether or not it is efficient.
simply
that it was a beautiful formula.
Fine. It's beautiful. No disagreemrnt there.
It is a personal opinion,
Which everyone is entitled to.
but I agree.
oo
--- k+1 1
> (-1) --------------
--- 2k(2k+1)(2k+2)
k=1
oo
1 --- k-1 1 2 1
= - > (-1) ( -- - ---- + ---- ) [partial fractions]
2 --- 2k 2k+1 2k+2
k=1
oo
1 --- k 1
= - + > (-1) ---- [collapse telescoping terms]
4 --- 2k+1
k=1
1 pi
= - + ( -- - 1 ) [Gregory series]
4 4
pi - 3
= ------
4
Being an alternating series with monotonically decreasing terms, the
error is less than 1/(8n^3) after n terms.
Some of us don't know how to do this. But given the series, I can
write a program to apply it.
But I would prefer a series that converges in ~300 terms to the
one that converges in ~10**34 terms.
How about Ramanujan's series that gets eight decimal places for each term?
1 2.sqrt{2} (4n)! [1103 + 26390n]
-- = --------- sum_n ------- ---------------
pi 9801 (n!)^4 (4*99)^4n
Also look up Euler's (who else?) transformation for accelerating
alternating series. In essence a difference table.
Abramowitz and Stegun, 3.6.27.
<http://mathworld.wolfram.com/EulersSeriesTransformation.html>
At <http://www.whim.org/nebula/math/eulerxform.html>, there is a
rigorous proof of the Euler Series Transform.
However, if we apply the acceleration using the identity
--- j C(m,j) k 1
> (-1) -------- = --- ----------
--- C(n+j,k) k+m C(n+m,k+m)
j
proven at <http://www.whim.org/nebula/math/binom.html>, we get
m
--- j C(m,j)
> (-1) ------
--- 1/2+j
j=0
2^{2m+1} m! m!
= --------------
(2m+1)!
Thus, the Euler Series Transform says
pi
oo
--- 2^{m+1} m! m!
= > -------------
--- (2m+1)!
m=0
Which converges much faster than the Gregory series, better than a
ratio of 2 per term.
This was even easier to implement.
Did you take advantage of the fact that the ratio of one term to the
next is m/(2m+1). That makes it a snap to implement:
1 1 2 1 2 3 1 2 3 4
pi = 2 ( 1 + - + - - + - - - + - - - - + ... )
3 3 5 3 5 7 3 5 7 9
Uh...that's the original formula I used. I thought
I mentioned that somewhere. No wonder I got virtually
the same number of terms.
In another thread on this topic, I found your reference:
<d835b1c3-d8b5-4e82-917e-804e7c681ed9@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
I missed it since it was in another thread.
In any case, this is the series that comes from the application of
the Euler Series Transform to the Gregory Series. Interesting on its
own.
However...
pi time: 0.0 seconds
31415926535897932384626433832795028841971693993751058209749445923078164062 862089986280348253421170679821480865132823066470938446095505822317253594081 284811174502841027019385211055596446229489549303819644288109756659334461284 756482337867831652712019091456485669234603486104543266482133936072602491412 737245870066063155881748815209209628292540917153643678925903600113305305488 2046652138414695194151160943
pi_also terms: 1328 time: 0.344000101089 seconds
31415926535897932384626433832795028841971693993751058209749445923078164062 862089986280348253421170679821480865132823066470938446095505822317253594081 284811174502841027019385211055596446229489549303819644288109756659334461284 756482337867831652712019091456485669234603486104543266482133936072602491412 737245870066063155881748815209209628292540917153643678925903600113305305488 2046652138414695194151160942
pi == pi_also: True
arctan(1/5) terms: 287 arctan(1/239) terms: 85 time:
0.0780000686646 seconds
31415926535897932384626433832795028841971693993751058209749445923078164062 862089986280348253421170679821480865132823066470938446095505822317253594081 284811174502841027019385211055596446229489549303819644288109756659334461284 756482337867831652712019091456485669234603486104543266482133936072602491412 737245870066063155881748815209209628292540917153643678925903600113305305488 2046652138414695194151160943
pi == pi_Machin: True
Euler terms: 1329 time: 3.0 seconds
31415926535897932384626433832795028841971693993751058209749445923078164062 862089986280348253421170679821480865132823066470938446095505822317253594081 284811174502841027019385211055596446229489549303819644288109756659334461284 756482337867831652712019091456485669234603486104543266482133936072602491412 737245870066063155881748815209209628292540917153643678925903600113305305488 2046652138414695194151160942
pi == pi_euler: True
It took just about as many terms as my original formula
and is much slower to calculate. And my original can't
hold a candle to the Machin formula.
I hope you did not use the factorial function in your implementation,
Well, a bit. But I certainly didn't re-calculate m! every term.
Obviously, not quite as efficient as the original, so there's
some needless calculation in my Euler algorithm.
That would explain the 3 second execution time.
but used the term to term ratio I pointed out above. If so, it should
be a little over
"Starnge, the line went dead just as Professor Press
was about to reveal the secret formula."
Okay, I'm confused, but that is not unusual.
I wasn't trying to get the quickest converging series, I was trying
to show that Euler Series Accleration can take a terribly slowly
converging series, like the Gregory Series, and make it into a
fairly quickly converging series.
Well, I'm not trying to find the quickest either, just an
easy to implement that does a reasonable job. I'm not trying
to do a billion digits or anything (this algorithm isn't
up to it).
The series that I accelerated from the Gregory series has only a
term to term ratio of about 2, which yields about .3 digits per term
(about 1335 terms for 402 digits).
The arccot(5) part of the Machin formula has a ratio of about 25, and
yields about 1.4 digits per term; the arccot(239) part has a ratio of
about 57121, and yields more than 4.75 digits per term. This comes
out to about 1.08 digit per term altogether (about 372 terms for 402
digits).
The quickest converging Machin-like series I have seen is Gauss's
pi = 48 arccot(18) + 32 arccot(57) - 20 arccot(239)
which yields about 1.12 digits per term altogether (about 359 terms
for 402 digits). However, I just looked up on MathWorld, and there
it has
pi = 732 arccot(239) + 128 arccot(1023) - 272 arccot(5832)
+ 48 arccot(110443) -48 arccot(4841182) - 400 arccot(6826318)
which comes in at over 1.51 digits per term.
Thanks for the info, I may try one of these just for laughs.
I'm certainly less concerned about the difference
between 372 and 359 than between 372 and 10^34.
Understandable.
Rob Johnson <rob@xxxxxxxxxxxxxx>
take out the trash before replying
to view any ASCII art, display article in a monospaced font
.
- Follow-Ups:
- Re: A Formula for Pi
- From: Mensanator
- Re: A Formula for Pi
- References:
- Re: A Formula for Pi
- From: José Carlos Santos
- Re: A Formula for Pi
- From: Maury Barbato
- Re: A Formula for Pi
- From: Mensanator
- Re: A Formula for Pi
- From: Rob Johnson
- Re: A Formula for Pi
- From: Mensanator
- Re: A Formula for Pi
- From: Michael Press
- Re: A Formula for Pi
- From: Rob Johnson
- Re: A Formula for Pi
- From: Mensanator
- Re: A Formula for Pi
- From: Rob Johnson
- Re: A Formula for Pi
- From: Mensanator
- Re: A Formula for Pi
- Prev by Date: New mathematics / physical sciences positions at http://jobs.phds.org, Jun 23, 2008
- Next by Date: Re: JSH: Diminishing concerns on factoring
- Previous by thread: Re: A Formula for Pi
- Next by thread: Re: A Formula for Pi
- Index(es):
Relevant Pages
|