Archives for: June 2007

11 June, 2007

Permalink 19:39 UTC, by Fernando J. Pereda, 211 words, 3478 views   English (US)
Categories: Uncategorized, Programming

Hidden PI

The people from Gaussianos.com (spanish blog abouth math) posted a couple of algorithms to calculate Pi and asked readers to provide some more.

I recently read on The Computational Beauty of Nature that Pi is hidden in the Mandelbrot set:

Take the mandelbrot iteration function:

z0 = 0
z = z^2 + c

And the initial complex number:

c = -3/4 + a * i

That set of complex numbers lays just between the two main parts of the body of the set, it is also known as the 'neck' (since it joins the cardiod with the biggest 'head').

For a = 0 the point belongs to the mandelbrot set. Let k be the number of iterations needed for a point (c = -3/4 + a * i) to reach modulus greater than 2 (escape radius), as a approaches to zero, k * a approaches to pi.

I wrote a simple C program that shows this (http://dev.gentoo.org/~ferdy/stuff/pi_mandel_gmp.c). When compiled, linked against libgmp and run, it outputs something like the following:

  a      || k         || aprox. pi
 --------++-----------++-----------
  1      || 3         || 3.0000000
  0.1    || 33        || 3.3000000
  0.01   || 315       || 3.1500000
  0.001  || 3143      || 3.1430000
  0.0001 || 31417     || 3.1417000
  1e-05  || 314160    || 3.1416000
  1e-06  || 3141593   || 3.1415930
  1e-07  || 31415927  || 3.1415927

It is an utterly expensive and pointless way to calculate pi, but it is one of the most obscure and weird ways to do it :)

Of course, all the credit goes to Dave Boll, who discovered the fact on 1991.

- ferdy

Fernando J. Pereda

Here you will find stories about Gentoo net-mail development from Fernando J. Pereda (ferdy).

June 2007
Mon Tue Wed Thu Fri Sat Sun
<< < Current > >>
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  

Search

Categories

Misc

XML Feeds

What is RSS?

Who's Online?

  • Guest Users: 145

powered by
b2evolution