{"id":3879,"date":"2011-09-13T16:30:45","date_gmt":"2011-09-13T15:30:45","guid":{"rendered":"http:\/\/www.walkingrandomly.com\/?p=3879"},"modified":"2011-09-13T16:30:45","modified_gmt":"2011-09-13T15:30:45","slug":"integration-fun-with-matlab-and-mathematica","status":"publish","type":"post","link":"https:\/\/walkingrandomly.com\/?p=3879","title":{"rendered":"Integration fun with MATLAB and Mathematica"},"content":{"rendered":"<p>Consider this indefinite integral<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/walkingrandomly.com\/wp-content\/ql-cache\/quicklatex.com-4f061f3f86e0372673dd13460e85377e_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#108;&#105;&#103;&#104;&#116;&#32;&#92;&#108;&#97;&#114;&#103;&#101;&#32;&#92;&#105;&#110;&#116;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#49;&#125;&#123;&#92;&#115;&#113;&#114;&#116;&#123;&#120;&#40;&#50;&#45;&#120;&#41;&#125;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"31\" width=\"76\" style=\"vertical-align: -15px;\"\/><\/p>\n<p>Feed it to MATLAB&#8217;s symbolic toolbox:<\/p>\n<pre>\r\nint(1\/sqrt(x*(2 - x)))\r\n\r\nans =\r\nasin(x - 1)\r\n<\/pre>\n<p>Feed it to Mathematica 8.0.1:<\/p>\n<pre>\r\nIntegrate[1\/Sqrt[x (2 - x)], x] \/\/ InputForm\r\n\r\n(2*Sqrt[-2 + x]*Sqrt[x]*Log[Sqrt[-2 + x] + Sqrt[x]])\/Sqrt[-((-2 + x)*x)]\r\n<\/pre>\n<p>Let x=1.2 in both results:<\/p>\n<pre>\r\nMATLAB's answer evaluates to 0.2014\r\nMathematica's answer evaluates to -1.36944 + 0.693147 I\r\n<\/pre>\n<p>Discuss!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Consider this indefinite integral Feed it to MATLAB&#8217;s symbolic toolbox: int(1\/sqrt(x*(2 &#8211; x))) ans = asin(x &#8211; 1) Feed it to Mathematica 8.0.1: Integrate[1\/Sqrt[x (2 &#8211; x)], x] \/\/ InputForm (2*Sqrt[-2 + x]*Sqrt[x]*Log[Sqrt[-2 + x] + Sqrt[x]])\/Sqrt[-((-2 + x)*x)] Let x=1.2 in both results: MATLAB&#8217;s answer evaluates to 0.2014 Mathematica&#8217;s answer evaluates to -1.36944 + [&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,45,8,11],"tags":[],"class_list":["post-3879","post","type-post","status-publish","format-standard","hentry","category-general-math","category-just-for-fun","category-mathematica","category-matlab"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3swhs-10z","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/3879","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=3879"}],"version-history":[{"count":6,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/3879\/revisions"}],"predecessor-version":[{"id":3885,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/3879\/revisions\/3885"}],"wp:attachment":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3879"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3879"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3879"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}