{"id":113,"date":"2011-08-23T16:20:34","date_gmt":"2011-08-23T21:20:34","guid":{"rendered":"http:\/\/puzzlezapper.com\/blog\/2011\/08\/children-of-julia-sets\/"},"modified":"2011-08-23T16:22:43","modified_gmt":"2011-08-23T21:22:43","slug":"children-of-julia-sets","status":"publish","type":"post","link":"https:\/\/puzzlezapper.com\/blog\/2011\/08\/children-of-julia-sets\/","title":{"rendered":"Children of Julia Sets"},"content":{"rendered":"<p>Here&#8217;s a pretty specimen I found while playing with a bit of code I wrote to produce quadratic Julia sets:<\/p>\n<p align=\"center\"><img decoding=\"async\" style=\"max-width: 800px;\" src=\"http:\/\/puzzlezapper.com\/aom\/mathrec\/julia4.png\" \/><\/p>\n<p>If you know your Julia sets, you might be thinking something odd is going on here.<\/p>\n<p>If you don&#8217;t, here&#8217;s a quick primer.<\/p>\n<p>Pick a complex constant <i>c<\/i>. Then for every point z in the complex plane, create a sequence with the following recursive definition:<br \/><i><br \/>z<\/i><sub>0<\/sub> = <i>z<\/i><br \/><i>z<\/i><sub><i>n<\/i>+1<\/sub> = <i>z<sub>n<\/sub><\/i><sup>2<\/sup> + <i>c<\/i><\/p>\n<p>This sequence will do one of two things. Either it will zip away from 0 and eventually go indefinitely far away, or it won&#8217;t. (It could converge to a single point, or alternate between a few points, or bounce around chaotically. It doesn&#8217;t matter.) The points where the sequence sticks around near zero form a quadratic Julia set. There are other kinds of Julia sets, defined using different formulas. But the kind of Julia set you will most commonly encounter is this one, and henceforward I will use the term Julia set to refer to this kind of Julia set.<\/p>\n<p>Julia sets are fun to play with because they are fractals, with infinite levels of detail and self-similarity. Some Julia sets form a single connected blob:<\/p>\n<p align=\"center\"><img decoding=\"async\" style=\"max-width: 800px;\" src=\"http:\/\/puzzlezapper.com\/aom\/mathrec\/julia5.png\" \/><br \/>Julia set for <i>c<\/i> = .3 + .2<i>i<\/i><\/p>\n<p>Other Julia sets form dusts, where any region that appears to be in the set is actually divided into separate disconnected regions, and these regions are themselves divided, ad infinitum:<\/p>\n<p align=\"center\"><img decoding=\"async\" style=\"max-width: 800px;\" src=\"http:\/\/puzzlezapper.com\/aom\/mathrec\/julia3.png\" \/><br \/>Julia set for <i>c<\/i> = .7 + .33<i>i<\/i><\/p>\n<p>I should note that I&#8217;m cheating here slightly. A dust isn&#8217;t actually much to look at. Although it contains an infinite number of points, the probability of an individual point being in a dust-like Julia set is 0, so if I were plotting it properly, there would be nothing to see. What I&#8217;m actually plotting for each point is a level of grey on a scale from 0 to 255 (the latter being black) corresponding to the number of iterations it took for the sequence to escape beyond a given bound. The use of a grayscale gives dusts a more organic look, which I rather like.<\/p>\n<p>Every Julia set is either a dust or a blob. The famous Mandelbrot set effectively catalogs this aspect of Julia sets. For every possible constant c, one checks only the behavior of 0 in the Julia set for that constant. If 0 escapes to infinity, we have a dust, otherwise we have a blob.&nbsp; Near the boundary, the blob thins into increasingly narrow filaments, but it remains in a single connected piece until the boundary is crossed, and the blob shatters into a dust. The Mandelbrot set contains all of the constants that give &#8220;blob-like&#8221; Julia sets.<\/p>\n<p align=\"center\"><img decoding=\"async\" style=\"max-width: 800px;\" src=\"http:\/\/puzzlezapper.com\/aom\/mathrec\/mandel.png\" \/><br \/>The Mandelbrot Set<\/p>\n<p>Getting back to my first image in this post, you can now see why I said there was something odd about it. That fractal is not a single blob; there are many disconnected parts. But it also isn&#8217;t a dust; there are filled solid regions. So it can&#8217;t be a proper Julia set. But it does have a Julia set &#8220;feel&#8221; to its self-similarity. So what&#8217;s going on?<\/p>\n<p>The answer is that instead of using a single constant at every step of iterating the sequences for each point, as one would for a proper Julia set, I alternated between two constants. In fact, the two constants I alternated between were precisely the constants for the blob and dust I showed above. Thus it is perhaps unsurprising that the &#8220;child&#8221; of a blob and a dust would show characteristics of each: those characteristics were in its &#8220;genes&#8221;.<\/p>\n<p>Alternating between the two constants in the opposite order gives the following:<\/p>\n<p align=\"center\"><img decoding=\"async\" style=\"max-width: 800px;\" src=\"http:\/\/puzzlezapper.com\/aom\/mathrec\/julia6.png\" \/><\/p>\n<p>Looks like the same basic pattern as before, but with two big connected bits instead of one. Notice that in this one the center point (z=0) is outside the set, while for the other one it was inside the set. Since this is the point that would tell us if we had a blob or a dust in a normal Julia set, it feels appropriate that it can go either way depending on the order here.<\/p>\n<p>Here&#8217;s the Python code that produced the last image:<\/p>\n<pre>from PIL import Image\nsize = 400\nim = Image.new(\"RGB\", (size, size))\nc = [.3 + .2j, -.70 + .33j] #j is i in python\nfor x in xrange(size):\n    for y in xrange(size):\n        z = x * (4.0 \/ size) - 2 + (y * (4.0 \/ size) - 2) * 1j \n        i = 0\n        while abs(z) &lt; 4 and i &lt; 256:  \n            z = z ** 2 + c[i % 2]\n            i += 1\n        im.putpixel((x,size-y-1), (255-i,255-i,255-i))\n\nim.save(\"julia6.png\")\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a pretty specimen I found while playing with a bit of code I wrote to produce quadratic Julia sets: If you know your Julia sets, you might be thinking something odd is going on here. If you don&#8217;t, here&#8217;s a quick primer. Pick a complex constant c. Then for every point z in the &hellip; <a href=\"https:\/\/puzzlezapper.com\/blog\/2011\/08\/children-of-julia-sets\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Children of Julia Sets<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[63,64,65,48],"class_list":["post-113","post","type-post","status-publish","format-standard","hentry","category-recreational-mathematics","tag-fractals","tag-julia-sets","tag-mandelbrot-set","tag-python"],"_links":{"self":[{"href":"https:\/\/puzzlezapper.com\/blog\/wp-json\/wp\/v2\/posts\/113","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/puzzlezapper.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/puzzlezapper.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/puzzlezapper.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/puzzlezapper.com\/blog\/wp-json\/wp\/v2\/comments?post=113"}],"version-history":[{"count":1,"href":"https:\/\/puzzlezapper.com\/blog\/wp-json\/wp\/v2\/posts\/113\/revisions"}],"predecessor-version":[{"id":114,"href":"https:\/\/puzzlezapper.com\/blog\/wp-json\/wp\/v2\/posts\/113\/revisions\/114"}],"wp:attachment":[{"href":"https:\/\/puzzlezapper.com\/blog\/wp-json\/wp\/v2\/media?parent=113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/puzzlezapper.com\/blog\/wp-json\/wp\/v2\/categories?post=113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/puzzlezapper.com\/blog\/wp-json\/wp\/v2\/tags?post=113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}