{"id":35,"date":"2007-06-11T21:39:01","date_gmt":"2007-06-11T19:39:29","guid":{"rendered":""},"modified":"2017-03-07T16:18:33","modified_gmt":"2017-03-07T16:18:33","slug":"hidden_pi","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/ferdy\/2007\/06\/11\/hidden_pi\/","title":{"rendered":"Hidden PI"},"content":{"rendered":"<p>The people from <a href=\"http:\/\/www.gaussianos.com\">Gaussianos.com<\/a> (spanish blog abouth math) posted a couple of <a href=\"http:\/\/gaussianos.com\/algoritmos-para-el-calculo-de-pi\/\">algorithms to calculate Pi<\/a> and asked readers to provide some more. <\/p>\n<p>I recently read on <a href=\"http:\/\/mitpress.mit.edu\/books\/FLAOH\/cbnhtml\/\">The Computational Beauty of Nature<\/a> that Pi is hidden in the Mandelbrot set:<\/p>\n<p>Take the mandelbrot iteration function:<\/p>\n<p><code>z0 = 0<br \/>\nz = z^2 + c<\/code><\/p>\n<p>And the initial complex number:<\/p>\n<p><code>c = -3\/4 + a * i<\/code><\/p>\n<p>That set of complex numbers lays just between the two main parts of the <i>body<\/i> of the set, it is also known as the &#8216;neck&#8217; (since it joins the cardiod with the biggest &#8216;head&#8217;).<\/p>\n<p>For <tt>a = 0<\/tt> the point belongs to the mandelbrot set. Let <tt>k<\/tt> be the number of iterations needed for a point (<tt>c = -3\/4 + a * i<\/tt>) to reach modulus greater than 2 (escape radius), as <tt>a<\/tt> approaches to zero, <tt>k * a<\/tt> approaches to pi.<\/p>\n<p>I wrote a simple C program that shows this (<a href=\"http:\/\/dev.gentoo.org\/~ferdy\/stuff\/pi_mandel_gmp.c\">http:\/\/dev.gentoo.org\/~ferdy\/stuff\/pi_mandel_gmp.c<\/a>). When compiled, linked against libgmp and run, it outputs something like the following:<\/p>\n<pre>  a      || k         || aprox. pi\r\n --------++-----------++-----------\r\n  1      || 3         || 3.0000000\r\n  0.1    || 33        || 3.3000000\r\n  0.01   || 315       || 3.1500000\r\n  0.001  || 3143      || 3.1430000\r\n  0.0001 || 31417     || 3.1417000\r\n  1e-05  || 314160    || 3.1416000\r\n  1e-06  || 3141593   || 3.1415930\r\n  1e-07  || 31415927  || 3.1415927<\/pre>\n<p>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 \ud83d\ude42<\/p>\n<p>Of course, all the credit goes to Dave Boll, who discovered the fact on 1991.<\/p>\n<p>&#8211; ferdy<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <a href=\"https:\/\/blogs.gentoo.org\/ferdy\/2007\/06\/11\/hidden_pi\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Hidden PI<\/span><\/a><\/p>\n","protected":false},"author":14,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,6],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/posts\/35"}],"collection":[{"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/comments?post=35"}],"version-history":[{"count":1,"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/posts\/35\/revisions"}],"predecessor-version":[{"id":52,"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/posts\/35\/revisions\/52"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/media?parent=35"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/categories?post=35"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ferdy\/wp-json\/wp\/v2\/tags?post=35"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}