{"id":867,"date":"2019-03-01T23:30:51","date_gmt":"2019-03-02T04:30:51","guid":{"rendered":"http:\/\/aristotle2digital.blogwyrm.com\/?p=867"},"modified":"2019-04-26T20:53:11","modified_gmt":"2019-04-27T00:53:11","slug":"chaos-game-part-4-the-game-as-art","status":"publish","type":"post","link":"https:\/\/aristotle2digital.blogwyrm.com\/?p=867","title":{"rendered":"Chaos Game Part 4 \u2013 The Game as Art"},"content":{"rendered":"<p>This month\u2019s installment will be the final column of this series on the chaos game.\u00a0 As befitting any swan song, this ending should be artistic and dramatic and awe-inspiring.\u00a0 Unfortunately, the chaos game isn\u2019t really dramatic or awe-inspiring \u2013 at least for most people \u2013 but it can be quite artistic.\u00a0 The patterns that can be produced can be quite beautiful and pleasing to the eye.\u00a0 So, this article will be mostly a tour of our local digital museum displaying the various works of art that one can produce using either the code heretofore presented or with some minor modifications.<\/p>\n<p>The first entry in our tour is the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Barnsley_fern\">Barnsley fern<\/a>, which is a self-similar structure invented by Michael Barnsley to resemble the black spleenwort fern.\u00a0 There are four entries into the set affine mappings that comprise the game:<\/p>\n<div class = \"myQuoteDiv\">\n<pre>\r\nbarnsley_fern = np.array([[0.01,\u00a0\u00a0 0,\u00a0\u00a0\u00a0\u00a0\u00a0 0,\u00a0\u00a0\u00a0 0,0.16,0,\u00a0\u00a0 0],\r\n                          [0.86, 0.85,\u00a0 0.04,-0.04,0.85,0,1.60],\r\n                          [0.93, 0.20, -0.26, 0.23,0.22,0,1.60],\r\n                          [1.00,-0.15,\u00a0 0.28, 0.26,0.24,0,0.44]])<\/pre>\n<\/div>\n<p>When run through the chaos game, a remarkably pleasing fern frond is found (alliteration, a sure sign of class).<\/p>\n<p><a href=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Barnsley_fern.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Barnsley_fern.jpg\" alt=\"\" width=\"451\" height=\"857\" class=\"aligncenter size-full wp-image-857\" srcset=\"https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Barnsley_fern.jpg 451w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Barnsley_fern-158x300.jpg 158w\" sizes=\"auto, (max-width: 451px) 100vw, 451px\" \/><\/a><\/p>\n<p>Surprisingly, one of the affine mappings in the table has only a 1 percent chance of being selected.  Modification of the first entry in the table of affine mappings from 0.01 to 0.2,<\/p>\n<div class = \"myQuoteDiv\">\n<pre>\r\nbarnsley_fern_2 = np.array([[0.20,\u00a0\u00a0 0,\u00a0\u00a0\u00a0\u00a0\u00a0 0,\u00a0\u00a0\u00a0 0,0.16,0,\u00a0\u00a0 0],\r\n                            [0.86, 0.85,\u00a0 0.04,-0.04,0.85,0,1.60],\r\n                            [0.93, 0.20, -0.26, 0.23,0.22,0,1.60],\r\n                            [1.00,-0.15,\u00a0 0.28, 0.26,0.24,0,0.44]])<\/pre>\n<\/div>\n<p>thus increasing the probability of using the first mapping at the expense of the second, results in a slightly less luxurious, or mangier but, nonetheless, quite similar frond.<\/p>\n<p><a href=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Barnsley_fern_2.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Barnsley_fern_2.jpg\" alt=\"\" width=\"430\" height=\"857\" class=\"aligncenter size-full wp-image-858\" srcset=\"https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Barnsley_fern_2.jpg 430w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Barnsley_fern_2-151x300.jpg 151w\" sizes=\"auto, (max-width: 430px) 100vw, 430px\" \/><\/a><\/p>\n<p>This result strongly supports the conclusion from the last post that the chaos game operations on this set of affine maps seems to be quite stable against changes.\u00a0 Play of this kind also opens the door to the idea of a meta chaos game where the exact set of affine maps used at any iteration is either subjected to small random variations or is picked from a larger set.\u00a0 In the latter case, one can imagine a meta algorithm selecting between the <em>barnsley_fern<\/em> and <em>barnsley_fern_2<\/em> tables for each frond as part of a larger plant or switching between the two at random.\u00a0 Perhaps this type of numerical experiment will form the subject of a future column.<\/p>\n<p>But now back to the tour.<\/p>\n<p>Other mathematicians, professional and amateur alike, have played with the set of affine mappings to create similar plant-like results.\u00a0 An interesting example, called here the Flatter Fern, has as its set of affine mappings<\/p>\n<div class = \"myQuoteDiv\">\n<pre>\r\nflatter_fern = np.array([[0.02,0,0,0,0.25,0,-0.4],\r\n                         [0.86,0.95,0.005,-0.005,0.93,-0.002,0.5],\r\n                         [0.93,0.035,-0.2,0.16,0.04,-0.09,0.02],\r\n                         [1.00,-0.04,0.2,0.16,0.04,0.083,0.12]])<\/pre>\n<\/div>\n<p>Using this table in the chaos game gives<\/p>\n<p><a href=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/flatter_fern.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/flatter_fern.jpg\" alt=\"\" width=\"343\" height=\"857\" class=\"aligncenter size-full wp-image-861\" srcset=\"https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/flatter_fern.jpg 343w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/flatter_fern-120x300.jpg 120w\" sizes=\"auto, (max-width: 343px) 100vw, 343px\" \/><\/a><\/p>\n<p>As in the previous case, the structure is self-similar but each of the leaf groups is thinner and straighter than in the Barnsley fern.<\/p>\n<p>Keeping with the botanical theme, another fan favorite is the Fractal Tree.\u00a0 Its set of affine maps is<\/p>\n<div class = \"myQuoteDiv\">\n<pre>\r\nfractal_tree\u00a0 = np.array([[0.05,\u00a0\u00a0 0,\u00a0\u00a0\u00a0 0,\u00a0\u00a0\u00a0 0, 0.5, 0,\u00a0 0],\r\n                          [0.45,0.42,-0.42, 0.42,0.42, 0,0.2],\r\n                          [0.85,0.42, 0.42,-0.42,0.42, 0,0.2],\r\n                          [1.00, 0.1,\u00a0\u00a0\u00a0 0,\u00a0\u00a0\u00a0 0, 0.1, 0,0.2]])<\/pre>\n<\/div>\n<p>Running the chaos game with this table gives something that looks more like broccoli than it does a tree.<\/p>\n<p><a href=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/fractal_tree.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/fractal_tree.jpg\" alt=\"\" width=\"857\" height=\"799\" class=\"aligncenter size-full wp-image-863\" srcset=\"https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/fractal_tree.jpg 857w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/fractal_tree-300x280.jpg 300w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/fractal_tree-768x716.jpg 768w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/fractal_tree-810x755.jpg 810w\" sizes=\"auto, (max-width: 857px) 100vw, 857px\" \/><\/a><\/p>\n<p>Once again, one can play with the stability of the game by adjusting the relative probabilities.\u00a0 By upping the probability of the first map of the set from 0.05 to 0.25, giving the following table<\/p>\n<div class = \"myQuoteDiv\">\n<pre>\r\nfractal_puff\u00a0 = np.array([[0.25,\u00a0\u00a0 0,\u00a0\u00a0\u00a0 0,\u00a0\u00a0\u00a0 0, 0.5, 0,\u00a0 0],\r\n [0.45,0.42,-0.42, 0.42,0.42, 0,0.2],\r\n\r\n[0.85,0.42, 0.42,-0.42,0.42, 0,0.2],\r\n\r\n[1.00, 0.1,\u00a0\u00a0\u00a0 0,\u00a0\u00a0\u00a0 0, 0.1, 0,0.2]])<\/pre>\n<\/div>\n<p>the chaos game produces a Fractal Puff<br \/>\n<a href=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/fractal_puff.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/fractal_puff.jpg\" alt=\"\" width=\"857\" height=\"803\" class=\"aligncenter size-full wp-image-862\" srcset=\"https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/fractal_puff.jpg 857w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/fractal_puff-300x281.jpg 300w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/fractal_puff-768x720.jpg 768w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/fractal_puff-810x759.jpg 810w\" sizes=\"auto, (max-width: 857px) 100vw, 857px\" \/><\/a><\/p>\n<p>which suggests that the outer edge is soft, fuzzy, and worn away.<\/p>\n<p>In the next wing of the museum awaits a curious set of geometric shapes.\u00a0 The one we will examine in detail is the Square, whose set of affine maps is displayed in the following table.<\/p>\n<div class = \"myQuoteDiv\">\n<pre>\r\nsquare\u00a0 = np.array([[0.25,0.5,0,0,0.5, 1, 1],\r\n                    [0.50,0.5,0,0,0.5,50, 1],\r\n                    [0.75,0.5,0,0,0.5, 1,50],\r\n                    [1.00,0.5,0,0,0.5,50,50]])<\/pre>\n<\/div>\n<p>In this case, running the chaos game with this table results in a uniformly filled region.<\/p>\n<p><a href=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/square_done_wrong.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/square_done_wrong.jpg\" alt=\"\" width=\"852\" height=\"857\" class=\"aligncenter size-full wp-image-866\" srcset=\"https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/square_done_wrong.jpg 852w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/square_done_wrong-150x150.jpg 150w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/square_done_wrong-298x300.jpg 298w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/square_done_wrong-768x773.jpg 768w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/square_done_wrong-810x815.jpg 810w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/square_done_wrong-54x54.jpg 54w\" sizes=\"auto, (max-width: 852px) 100vw, 852px\" \/><\/a><\/p>\n<p>The trick to making a fractal appear is to restrict the selection of the vertex so that the same vertex cannot be picked in a row.\u00a0 The easiest modification to the code used in these explorations is to create a new transformation function<\/p>\n<div class = \"myQuoteDiv\">\n<pre>\r\ndef Transform2(point,table,r,prev_N):\r\n    x0 = point[0]\r\n    y0 = point[1]\r\n    for i in range(len(table)):\r\n        if r <= table[i,0]:\r\n            N = i\r\n            break\r\n    if N != prev_N:\r\n        x = table[N,1]*x0 + table[N,2]*y0 + table[N,5]\r\n        y = table[N,3]*x0 + table[N,4]*y0 + table[N,6]\r\n    else:\r\n        x = np.NaN\r\n        y = np.NaN\r\n    \r\n    return np.array([x,y]), N<\/pre>\n<\/div>\n<p>that is aware of the previous vertex (the variable prev_N) and returns a null result for the new point. \u00a0\u00a0Testing the return value keeps the \u2018bad\u2019 point out of the results giving the following pattern<\/p>\n<p><a href=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/square_done_right.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/square_done_right.jpg\" alt=\"\" width=\"857\" height=\"826\" class=\"aligncenter size-full wp-image-865\" srcset=\"https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/square_done_right.jpg 857w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/square_done_right-300x289.jpg 300w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/square_done_right-768x740.jpg 768w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/square_done_right-810x781.jpg 810w\" sizes=\"auto, (max-width: 857px) 100vw, 857px\" \/><\/a><\/p>\n<p>The <a href=\"https:\/\/en.wikipedia.org\/wiki\/Chaos_game\">Wikipedia article on the chaos game<\/a>, has a stunning gallery of geometric shapes that result from by similar types of rules restricting vertices.\u00a0 Particularly interesting are the pentagon examples by Edward Haas.<\/p>\n<p>The <a href=\"https:\/\/commons.wikimedia.org\/w\/index.php?curid=59330782\">first one<\/a>, shows the resulting pattern by using an analogous set of maps to the square and restricting the vertex to be strictly different from the one before.<\/p>\n<p><a href=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Chaos_Game_pentagon-EH-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Chaos_Game_pentagon-EH-1.png\" alt=\"\" width=\"600\" height=\"600\" class=\"aligncenter size-full wp-image-859\" srcset=\"https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Chaos_Game_pentagon-EH-1.png 600w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Chaos_Game_pentagon-EH-1-150x150.png 150w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Chaos_Game_pentagon-EH-1-300x300.png 300w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Chaos_Game_pentagon-EH-1-54x54.png 54w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>In <a href=\"https:\/\/commons.wikimedia.org\/wiki\/File:Chaos_Game_pentagon-EH-2.png\">Haas\u2019s second case<\/a>, the pattern results from using the same table as his first case, but with the restriction that the new vertex cannot be 1 or 4 places away from the two previously chosen vertices.<\/p>\n<p><a href=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Chaos_Game_pentagon-EH-2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Chaos_Game_pentagon-EH-2.png\" alt=\"\" width=\"600\" height=\"600\" class=\"aligncenter size-full wp-image-860\" srcset=\"https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Chaos_Game_pentagon-EH-2.png 600w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Chaos_Game_pentagon-EH-2-150x150.png 150w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Chaos_Game_pentagon-EH-2-300x300.png 300w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/Chaos_Game_pentagon-EH-2-54x54.png 54w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>While both cases exhibit five-fold symmetry the differences that arise solely due to the restriction on the allowed vertices is startling.<\/p>\n<p>The final exhibit is a mix of the botanical and the geometric.\u00a0 The Fractal Tree table was used with the vertex restriction rule used with the square.\u00a0 The resulting Fractal Twig is beautiful in its brutal desolation (always wanted to talk like a snooty, pretentious modern art dealer)<\/p>\n<p><a href=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/fractal_twig.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/fractal_twig.jpg\" alt=\"\" width=\"652\" height=\"857\" class=\"aligncenter size-full wp-image-864\" srcset=\"https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/fractal_twig.jpg 652w, https:\/\/aristotle2digital.blogwyrm.com\/wp-content\/uploads\/2019\/02\/fractal_twig-228x300.jpg 228w\" sizes=\"auto, (max-width: 652px) 100vw, 652px\" \/><\/a><\/p>\n<p>So, it seems as if the sky is the limit in creating digital art using the chaos game.\u00a0 I suspect we\u2019ve only scratched the surface.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This month\u2019s installment will be the final column of this series on the chaos game.\u00a0 As befitting any swan song, this ending should be artistic and dramatic and awe-inspiring.\u00a0 Unfortunately,&#8230; <a class=\"read-more-button\" href=\"https:\/\/aristotle2digital.blogwyrm.com\/?p=867\">Read more &gt;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-867","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/aristotle2digital.blogwyrm.com\/index.php?rest_route=\/wp\/v2\/posts\/867","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aristotle2digital.blogwyrm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aristotle2digital.blogwyrm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aristotle2digital.blogwyrm.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/aristotle2digital.blogwyrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=867"}],"version-history":[{"count":0,"href":"https:\/\/aristotle2digital.blogwyrm.com\/index.php?rest_route=\/wp\/v2\/posts\/867\/revisions"}],"wp:attachment":[{"href":"https:\/\/aristotle2digital.blogwyrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=867"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aristotle2digital.blogwyrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=867"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aristotle2digital.blogwyrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}