{"id":9329,"date":"2014-07-31T09:27:59","date_gmt":"2014-07-31T01:27:59","guid":{"rendered":"http:\/\/www.intmath.com\/blog\/?p=9329"},"modified":"2019-07-10T11:33:09","modified_gmt":"2019-07-10T03:33:09","slug":"context-free-math-based-art","status":"publish","type":"post","link":"https:\/\/www.intmath.com\/blog\/mathematics\/context-free-math-based-art-9329","title":{"rendered":"Context Free math-based art"},"content":{"rendered":"<h2>Context Free<\/h2>\n<p>Context Free is software that you can use to generate fascinating art work. You give instructions using code called a &quot;grammar&quot;. It's quite a neat way to bring together math, art and programming, which are key STEM skills. <\/p>\n<p>The <a href=\"http:\/\/www.contextfreeart.org\/\">Context Free Art<\/a> site provides downloads of the (free) software (Mac, Windows and Linux), and also a gallery of around 1000 works of art generated using the program. <\/p>\n<p>Everything is released using a Creative Commons non-commercial license, so you can use the images in your own work. You can modify other people's code to create your own materpieces (but give credit to the original, of course).<\/p>\n<p>Here are some of the output images from the <a href=\"http:\/\/www.contextfreeart.org\/gallery\/index.php\">gallery<\/a>: <\/p>\n<p><img loading=\"lazy\" src=\"https:\/\/www.intmath.com\/blog\/wp-content\/images\/2014\/07\/sm_thumb_3481.jpg\" alt=\"hertz - math art\" height=\"100\" width=\"99\" \/><img loading=\"lazy\" src=\"https:\/\/www.intmath.com\/blog\/wp-content\/images\/2014\/07\/sm_thumb_904.jpg\" alt=\"spikes - math art\" height=\"100\" width=\"84\" \/><img loading=\"lazy\" src=\"https:\/\/www.intmath.com\/blog\/wp-content\/images\/2014\/07\/sm_thumb_1156871190.png\" alt=\"swirls - math art\" height=\"89\" width=\"100\" \/><img loading=\"lazy\" src=\"https:\/\/www.intmath.com\/blog\/wp-content\/images\/2014\/07\/sm_thumb_1121950142.png\" alt=\"star - math art\" height=\"100\" width=\"100\" \/><img loading=\"lazy\" src=\"https:\/\/www.intmath.com\/blog\/wp-content\/images\/2014\/07\/sm_thumb_865.jpg\" alt=\"seed pods - math art\" height=\"86\" width=\"100\" \/><\/p>\n<h2>Math involved<\/h2>\n<p>Drawing these images involves some interesting math topics, including:<\/p>\n<ul>\n<li>Trigonometry<\/li>\n<li>Logarithms<\/li>\n<li>Matrices<\/li>\n<li>Vectors<\/li>\n<li>Geometry<\/li>\n<li>Number theory<\/li>\n<li>Complex numbers   <\/li>\n<\/ul>\n<h2>Example image<\/h2>\n<p>This one is called the Lorenz Attractor, by thijs: <\/p>\n<p><img loading=\"lazy\" src=\"https:\/\/www.intmath.com\/blog\/wp-content\/images\/2014\/06\/lorenz-attractor-context-free-arta.jpg\" alt=\"lorenz attractor context free art\" height=\"169\" width=\"300\" \/><\/p>\n<p>To give you an idea what is involved, this is the code thijs wrote to produce the above shape:<\/p>\n<blockquote>\n<pre>startshape Lorenz_Attractor \/\/1600*900\r\n\r\nCF::Background = [b -0.9 sat 0.2]\r\nCF::Size=[s 60 33.75]\r\nCF::ColorDepth = 16\r\nCF::MinimumSize= 0.3\r\nCF::Impure = 1\r\n\r\nA=10 B=8\/3 C=28 d=0.002\r\nvector3 D(vector3 V)\r\n=V[0]+d*( A*(V[1]-V[0]) )\r\n,V[1]+d*( V[0]*(C-V[2])-V[1] )\r\n,V[2]+d*( V[0]*V[1]-B*V[2] )\r\n\r\nvector3 M(vector3 V1,vector3 V2)\r\n=(V1[0]+V2[0])\/2\r\n,(V1[1]+V2[1])\/2\r\n,(V1[2]+V2[2])\/2\r\n\r\n\/\/------------------------------------\r\nshape Lorenz_Attractor\r\n{ V0=(-12.5, -17.4, 26)\r\nNext(0,V0)[r 100]\r\n}\r\n\r\nshape Next (i,vector3 Vi)\r\n{ if (i<320000)\r\n{ Vn=M(Vi,D(D(Vi)))\r\nPlot (i,Vi,Vn) []\r\nNext (i+1 ,Vn) []\r\n} }\r\n\r\nshape Plot(i,vector3 V0,vector3 V1)\r\n{ P=V0[0,2] Q=V1[0,2] Z=V0[2]\r\nH=45+15*sin(i\/3)\r\nLine(0.05,P,Q) [z Z b 1 h H sat .4]\r\nLine(0.15,P,Q) [z Z b -1 a -.950]\r\nLine(1.50,P,Q) [z Z b -1 a -.999]\r\n}\r\n\r\npath Line(S,vector2 P,vector2 Q)\r\n{ MOVETO(P) LINETO(Q)\r\nSTROKE(S,CF::RoundCap)[] <\/pre>\n<\/blockquote>\n<p><!--h2>More information <\/h2>\n\n\n\n\n\n\n\n\n<p>Here's a useful list of resources by Mikael Hvidtfeldt Christensen: <a href=\"http:\/\/blog.hvidtfeldts.net\/index.php\/generative-art-links\/\">Generative Art Links<\/a>, containing links to some interesting software for creating several different types of math art, including 3D fractals, and there's also some interesting blogs. <\/p-->\n<p class=\"alt\"><a href=\"#respond\" id=\"comms\">Be the first to comment<\/a> below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><a href=\"https:\/\/www.intmath.com\/blog\/mathematics\/context-free-math-based-art-9329\"><img loading=\"lazy\" src=\"\/blog\/wp-content\/images\/2014\/06\/lorenz-attractor-context-free-art_th.jpg\" alt=\"lorenz attractor context free art\" width=\"128\" height=\"100\" class=\"imgRt\" \/><\/a>Context Free is software you can use to produce some beautiful math-based art. Build STEM skills while triggering your creative side.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mo_disable_npp":""},"categories":[4],"tags":[127],"_links":{"self":[{"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/posts\/9329"}],"collection":[{"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/comments?post=9329"}],"version-history":[{"count":1,"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/posts\/9329\/revisions"}],"predecessor-version":[{"id":12072,"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/posts\/9329\/revisions\/12072"}],"wp:attachment":[{"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/media?parent=9329"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/categories?post=9329"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.intmath.com\/blog\/wp-json\/wp\/v2\/tags?post=9329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}