{"id":436,"date":"2008-12-12T18:55:43","date_gmt":"2008-12-12T17:55:43","guid":{"rendered":"http:\/\/www.walkingrandomly.com\/?p=436"},"modified":"2008-12-12T18:57:33","modified_gmt":"2008-12-12T17:57:33","slug":"christmas-greetings-sage-style","status":"publish","type":"post","link":"https:\/\/walkingrandomly.com\/?p=436","title":{"rendered":"Christmas greetings &#8211; SAGE style"},"content":{"rendered":"<p>David Joyner of the <a href=\"http:\/\/www.sagemath.org\/\">SAGE<\/a> development team has come up with a couple of very nice mathematical Christmas greetings using a combination of SAGE (For the mathematics used to generate the images) and<a href=\"http:\/\/www.gimp.org\/\"> GIMP<\/a> and <a href=\"http:\/\/www.inkscape.org\/\">Inkscape<\/a> (for the text).\u00a0 The first one is based on a <a href=\"http:\/\/en.wikipedia.org\/wiki\/Michael_Barnsley\">Barnsley Fractal<\/a> and the <a href=\"images\/SAGE\/barnsley-fern.sage\">sage source code is available here<\/a>.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"aligncenter\" src=\"\/images\/SAGE\/smallfern.png\" alt=\"small fern\" \/><\/p>\n<p>David&#8217;s other creation is a <a href=\"http:\/\/en.wikipedia.org\/wiki\/Sierpinski_triangle\">Sierpinski gasket<\/a> that has been coloured such that it resembles a Christmas tree.\u00a0 The SAGE source code is given below.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"aligncenter\" src=\"\/images\/SAGE\/smallgasket.png\" alt=\"gasket\" \/><\/p>\n<p><code><br \/>\ndef sierpinski_seasons_greetings():<br \/>\n\"\"\"<br \/>\nCode by Marshall Hampton.<br \/>\nColors by David Joyner.<br \/>\nGeneral depth by Rob Beezer.<br \/>\nCopyright Marshall Hampton 2008, licensed<br \/>\ncreative commons, attribution share-alike.<br \/>\n\"\"\"<br \/>\ndepth = 7<br \/>\nnsq = RR(3^(1\/2))\/2.0<br \/>\ntlist_old = [[[-1\/2.0,0.0],[1\/2.0,0.0],[0.0,nsq]]]<br \/>\ntlist_new = [x for x in tlist_old]<br \/>\nfor ind in range(depth):<br \/>\nfor tri in tlist_old:<br \/>\nfor p in tri:<br \/>\nnew_tri = [[(p[0]+x[0])\/2.0, (p[1]+x[1])\/2.0] for x in tri]<br \/>\ntlist_new.append(new_tri)<br \/>\ntlist_old = [x for x in tlist_new]<br \/>\nT = tlist_old<br \/>\nN  = 4^depth<br \/>\nN1 = N - 3^depth<br \/>\nq1 = sum([line(T[i]+[T[i][0]], rgbcolor = (0,1,0)) for i in range(N1)])<br \/>\nq2 = sum([line(T[i]+[T[i][0]], rgbcolor = (1,0,0)) for i in range(N1,N)])<br \/>\nshow(q2+q1, figsize = [6,6*nsq], axes = False)<br \/>\n<\/code><\/p>\n<p>It just goes to show that advanced mathematical software such as SAGE doesn&#8217;t just have to be used for teaching and research &#8211; it can be used for making mathematical Christmas cards too!  SAGE is completely free and is available from the <a href=\"http:\/\/www.sagemath.org\/\">SAGE math website<\/a>.  Thanks to David for his work on this one.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>David Joyner of the SAGE development team has come up with a couple of very nice mathematical Christmas greetings using a combination of SAGE (For the mathematics used to generate the images) and GIMP and Inkscape (for the text).\u00a0 The first one is based on a Barnsley Fractal and the sage source code is available [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6,24],"tags":[],"class_list":["post-436","post","type-post","status-publish","format-standard","hentry","category-general-math","category-sage-interactions"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3swhs-72","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=436"}],"version-history":[{"count":9,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/436\/revisions"}],"predecessor-version":[{"id":450,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/436\/revisions\/450"}],"wp:attachment":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}