{"id":5393,"date":"2014-03-12T16:50:33","date_gmt":"2014-03-12T15:50:33","guid":{"rendered":"http:\/\/www.walkingrandomly.com\/?p=5393"},"modified":"2014-03-12T16:50:33","modified_gmt":"2014-03-12T15:50:33","slug":"waves-from-circles-with-mathematica","status":"publish","type":"post","link":"https:\/\/walkingrandomly.com\/?p=5393","title":{"rendered":"Waves from Circles with Mathematica"},"content":{"rendered":"<p>A recent <a href=\"https:\/\/plus.google.com\/+Mathemania4u\/posts\/EqThbSKyoGK\">Google+ post from Mathemania4u<\/a> caught my attention on the train to work this morning. I just had to code up something that looked like this and so fired up Mathematica and hacked away. The<a href=\"https:\/\/www.walkingrandomly.com\/images\/mathematica9\/circle_notebook.nb\"> resulting notebook can be downloaded here<\/a>. It&#8217;s not particularly well thought through so could almost certainly be improved on in many ways.<\/p>\n<p>The end result was a Manipulate which you&#8217;ll be able to play with below, provided you have a compatible Operating System and Web browser. The code for the Manipulate is<\/p>\n<pre>Manipulate[\r\n Graphics[Map[dotCirc, \r\n   circArray[circrad, theta, pointsize, extent, step, phase, \r\n    showcirc]]]\r\n , {{showcirc, True, \"Show Circles\"}, {True, False}}\r\n , {{theta, 0, \"Dot Angle\"}, 0, 2 Pi, Pi\/10, Appearance -&gt; \"Labeled\"}\r\n , {{pointsize, 0.018, \"Dot Size\"}, 0, 1, Appearance -&gt; \"Labeled\"}\r\n , {{phase, 2, \"Phase Diff\"}, 0, 2 Pi, Appearance -&gt; \"Labeled\"}\r\n , {{step, 0.25, \"Circle Separation\"}, 0, 1, Appearance -&gt; \"Labeled\"}\r\n , {{extent, 2, \"Plot Extent\"}, 1, 5, Appearance -&gt; \"Labeled\"}\r\n , {{circrad, 0.15, \"Circle Radius\"}, 0.01, 1, Appearance -&gt; \"Labeled\"}\r\n , Initialization :&gt;\r\n  {\r\n   dotCirc[{x_, y_, r_, theta_, pointsize_, showcirc_}] := If[showcirc,\r\n     {Circle[{x, y}, r], PointSize[pointsize], \r\n      Point[{x + r Cos[theta], y + r Sin[theta]}]}\r\n     ,\r\n     {PointSize[pointsize], \r\n      Point[{x + r Cos[theta], y + r Sin[theta]}]}]\r\n   ,\r\n   circArray[r_, theta_, pointsize_, extent_, step_, phase_, \r\n     showcirc_] := Module[{},\r\n     Partition[\r\n      Flatten[Table[{x, y, r, theta + x*phase + y*phase, pointsize, \r\n         showcirc}, {x, -extent, extent, step}, {y, -extent, extent, \r\n         step}]], 6]\r\n     ]}]<\/pre>\n<p>If you can use the Manipulate below, I suggest clicking on the + icon to the right of the &#8216;Dot Angle&#8217; field to expose the player controls and then press the play button to kick off the animation.<\/p>\n<p><script type=\"text\/javascript\" src=\"http:\/\/www.wolfram.com\/cdf-player\/plugin\/v2.1\/cdfplugin.js\"><\/script><script type=\"text\/javascript\">\/\/ <![CDATA[\nvar cdf = new cdfplugin();\ncdf.setDefaultContent('<a href=\"http:\/\/www.wolfram.com\/cdf-player\/\"><img decoding=\"async\"  src=\"https:\/\/www.walkingrandomly.com\/images\/mathematica9\/circleWaves.png\"><\/a>');\ncdf.embed('https:\/\/www.walkingrandomly.com\/images\/mathematica9\/circleWaves.cdf', 1128, 734);\n\/\/ ]]><\/script><\/p>\n<p>I also produced a video &#8211; The code used to produce this <a href=\"https:\/\/www.walkingrandomly.com\/images\/mathematica9\/circle_notebook.nb\">is in the notebook<\/a>.<br \/>\n<iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"\/\/www.youtube.com\/embed\/yjtxJoDfaN4\" frameborder=\"0\" allowfullscreen><\/iframe>)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A recent Google+ post from Mathemania4u caught my attention on the train to work this morning. I just had to code up something that looked like this and so fired up Mathematica and hacked away. The resulting notebook can be downloaded here. It&#8217;s not particularly well thought through so could almost certainly be improved on [&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":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6,45,8],"tags":[],"class_list":["post-5393","post","type-post","status-publish","format-standard","hentry","category-general-math","category-just-for-fun","category-mathematica"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3swhs-1oZ","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/5393","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=5393"}],"version-history":[{"count":18,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/5393\/revisions"}],"predecessor-version":[{"id":5415,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/5393\/revisions\/5415"}],"wp:attachment":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}