Re: A Formula for Pi



In article <_eydnathcdmdo8LVnZ2dnUVZ_s3inZ2d@xxxxxxxxx>,
James Waldby <no@xxxxx> wrote:

On Sun, 22 Jun 2008 18:01:25 -0700, Michael Press wrote:
[...] James Waldby <no@xxxxx> wrote:
On Sat, 21 Jun 2008 21:37:06 -0700, Michael Press wrote:
[...] Mensanator <mensanator@xxxxxxx> wrote:
[...]
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
[Call this series R]
[...]
M. previously said he is using gmp rational arithmetic, so might rule
out R because of its sqrt(2) multiplier.

Good rational approximations to sqrt{2} are easy to get.

On a different
tack, computing one term of R is as expensive as computing several
terms of Machin's formula. (Perhaps 13 multiplies, 1 divide,

No divides.

Ok, right -- rational arithmetic. Also, I know 13 is wrong; I
counted the same complement of 10 multiplies you show below but
overlooked it when posting earlier.

(4n)! --> (4(n+1))! 4 multiplies
(n!)^4 --> ((n+1)!)^4 3 multiplies
(4*99)^(4n) --> (4*99)^(4(n+1)) 1 multiply
Multiplication of terms: 2 multiplies

and some adds per R term,
vs. 2 multiplies, 1 divide, and some adds per Machin term.)

Likewise, with gpm rational arithmetic there's no divide per term
for the Machin calculation of pi/4 = 4 atan(1/5) - atan(1/239),
with atan(x) = x - x^3/3 + x^5/5 - ... (or in the Machin variants
noted by Rob Johnson). All these methods - R included - may need
additional multiplies to create common denominators while adding
up terms.

Agreed.

--
Michael Press
.



Relevant Pages

  • Re: A Formula for Pi
    ... In essence a difference table. ... computing one term of R is as expensive as computing several ... some adds per R term, vs. 2 multiplies, 1 divide, and some adds per ...
    (sci.math)
  • Re: multiply/divide algorithm
    ... yes there are algorithms to do multiply and divide. ... fixed-point multiplies. ... I'm sorry that responses to your post weren't all attempting to be helpful ...
    (comp.lang.verilog)
  • Re: the reach of VHDL
    ... formula or it should be left for microblaze. ... particularly from the ever inspiring DSP litterature. ... Since you divide by 12.5, you actually use another 100x factor. ... which uses multiplies and add/sub operators. ...
    (comp.arch.fpga)
  • Re: [PATCH] SLAB : use a multiply instead of a divide in obj_to_index()
    ... can be used from other parts of the kernel as well? ... AFAIK this particular divide is the only one that hurts performance on ... s for the version using multiplies ... When some objects are allocated by one CPU but freed by another CPU we can ...
    (Linux-Kernel)
  • Re: Fast Binary to BCD method on ARM9 with huge numbers?
    ... The legacy codebase works in BCD, ... I also need all the digits, ... For a simple improvement, instead of dividing my ten, divide by ... If you've got an ARM with long multiplies, ...
    (comp.arch.embedded)

Quantcast