{"id":4030,"date":"2011-12-31T10:41:35","date_gmt":"2011-12-31T09:41:35","guid":{"rendered":"http:\/\/www.walkingrandomly.com\/?p=4030"},"modified":"2016-06-07T17:57:58","modified_gmt":"2016-06-07T16:57:58","slug":"how-to-plot-a-heart","status":"publish","type":"post","link":"https:\/\/walkingrandomly.com\/?p=4030","title":{"rendered":"How to plot a heart"},"content":{"rendered":"<p>I&#8217;ve seen several equations that plot a heart shape over the years but a recent google+ post by<a href=\"https:\/\/plus.google.com\/102041650722373356102\/posts\"> Lionel Favre<\/a> introduced me to a new one.\u00a0 I liked it so much that I didn&#8217;t want to wait until Valentine&#8217;s day to share it.\u00a0 In Mathematica:<\/p>\n<pre>Plot[Sqrt[Cos[x]]*Cos[200*x] + Sqrt[Abs[x]] - 0.7*(4 - x*x)^0.01, {x, -2, 2}]<\/pre>\n<p>and in MATLAB:<\/p>\n<pre>&gt;&gt; x=[-2:.001:2];\r\n&gt;&gt; y=(sqrt(cos(x)).*cos(200*x)+sqrt(abs(x))-0.7).*(4-x.*x).^0.01;\r\n&gt;&gt; plot(x,y)\r\nWarning: Imaginary parts of complex X and\/or Y arguments ignored<\/pre>\n<p style=\"text-align: left;\">The result from the MATLAB version is shown below<br \/>\n<img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/www.walkingrandomly.com\/images\/random\/heart2011.png\" alt=\"Heart Plot\" \/><\/p>\n<p style=\"text-align: left;\"><strong>Update<\/strong><\/p>\n<p style=\"text-align: left;\">Rene Grothmann has <a href=\"http:\/\/mga010.wordpress.com\/2012\/01\/08\/the-heart\/\">looked at this equation in a little more depth<\/a> and plotted it using Euler.<\/p>\n<p style=\"text-align: left;\"><strong>Similar posts<\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/www.walkingrandomly.com\/?p=2326\">A little mathematics for Valentine&#8217;s day<\/a><\/li>\n<li><a href=\"https:\/\/www.walkingrandomly.com\/?p=19\">The equation that says Hi<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve seen several equations that plot a heart shape over the years but a recent google+ post by Lionel Favre introduced me to a new one.\u00a0 I liked it so much that I didn&#8217;t want to wait until Valentine&#8217;s day to share it.\u00a0 In Mathematica: Plot[Sqrt[Cos[x]]*Cos[200*x] + Sqrt[Abs[x]] &#8211; 0.7*(4 &#8211; x*x)^0.01, {x, -2, 2}] [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","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":[45,8,11],"tags":[],"class_list":["post-4030","post","type-post","status-publish","format-standard","hentry","category-just-for-fun","category-mathematica","category-matlab"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3swhs-130","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/4030","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=4030"}],"version-history":[{"count":6,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/4030\/revisions"}],"predecessor-version":[{"id":6125,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/4030\/revisions\/6125"}],"wp:attachment":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4030"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4030"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4030"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}