{"id":49,"date":"2008-01-11T13:17:54","date_gmt":"2008-01-11T12:17:54","guid":{"rendered":"http:\/\/www.walkingrandomly.com\/?p=49"},"modified":"2010-02-01T10:56:05","modified_gmt":"2010-02-01T09:56:05","slug":"an-integral-that-maxima-and-you-can-do-better-than-mathematica","status":"publish","type":"post","link":"https:\/\/walkingrandomly.com\/?p=49","title":{"rendered":"An integral that Maxima (and you) can do better than Mathematica"},"content":{"rendered":"<p>How good is your symbolic integral calculus?  Do you think that you can do better than Mathematica? Let&#8217;s see &#8211; try and evaluate the following (there is a hint in the comments if you get stuck).<\/p>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/walkingrandomly.com\/wp-content\/ql-cache\/quicklatex.com-e8201a99e32ba9873612c294a8d9316e_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#32;&#92;&#108;&#105;&#103;&#104;&#116;&#32;&#92;&#105;&#110;&#116;&#95;&#48;&#94;&#49;&#92;&#102;&#114;&#97;&#99;&#123;&#120;&#94;&#51;&#32;&#43;&#32;&#49;&#125;&#123;&#120;&#94;&#52;&#32;&#43;&#32;&#52;&#120;&#32;&#43;&#32;&#49;&#125;&#100;&#120;\" title=\"Rendered by QuickLaTeX.com\" height=\"26\" width=\"103\" style=\"vertical-align: -8px;\"\/><\/p>\n<p align=\"left\">My integration skills are a little rusty but I found the solution, log(6)\/4, without too much difficulty (I have picked up the habit of writing log(x) when I mean ln(x) from using computer algebra packages too much) .  Let&#8217;s see how Mathematica handles the same integration.  Plugging the following command into version 6<\/p>\n<p align=\"left\">Integrate[(x^3 + 1)\/(x^4 + 4*x + 1), {x, 0, 1}]<\/p>\n<p align=\"left\">gives a solution of<\/p>\n<p align=\"left\">(RootSum[1 + 4*#1 + #1^4 &amp; , Log[1 &#8211; #1]\/(1 + #1^3) &amp; ] -RootSum[1 + 4*#1 + #1^4 &amp; , Log[-#1]\/(1 + #1^3) &amp; ] +<br \/>\nRootSum[1 + 4*#1 + #1^4 &amp; ,(Log[1 &#8211; #1]*#1^3)\/(1 + #1^3) &amp; ] -RootSum[1 + 4*#1 + #1^4 &amp; , (Log[-#1]*#1^3)\/(1 + #1^3) &amp; ])\/4<\/p>\n<p align=\"left\">Ugh! Applying the FullSimplify command doesn&#8217;t help so it seems that this is the best that Mathematica can do at the moment.  If you evaluate this expression numerically then it agrees with the symbolic result but I think you would agree that Mathematica has not done a very good job here.<\/p>\n<p>I found this integral while looking through the <a href=\"http:\/\/maxima.cvs.sourceforge.net\/*checkout*\/maxima\/maxima\/ChangeLog-5.14.0\">changelog<\/a> of the latest version of <a href=\"http:\/\/maxima.sourceforge.net\/\">Maxima<\/a> &#8211; an open source mathematics package.  If you try and evaluate it in  pre-5.14 versions of Maxima then it will appear to hang (actually it will return a result eventually if you leave it long enough and have enough memory but it makes the Mathematica result look positively pretty).  This has been fixed in version 5.14 and now issuing the command<\/p>\n<p align=\"left\">integrate ((x^3 + 1)\/(x^4 + 4*x + 1),x,0,1);<\/p>\n<p>gives the result you would expect.  So what went wrong &#8211; why does such a simple integral cause problems with these powerful software packages?  The answer can be found in the full <a href=\"http:\/\/sourceforge.net\/tracker\/index.php?func=detail&amp;aid=1778796&amp;group_id=4933&amp;atid=104933\">Maxima bug report<\/a> for this issue &#8211; I will let you read it yourself if you are interested but in a nutshell pre 5.14 versions of Maxima were attempting to use a technique from complex analysis called contour integration to evaluate this integral.  Contour integration is an amazingly useful technique that can be used to evaluate all sorts of definite integrals that are very difficult to do via other methods but using it in this case was a bad idea.  It is possible that Mathematica tried to evaluate the integral in the same way but since it is closed source only the developers at Wolfram know the answer to that.<\/p>\n<p>So this has been fixed in Maxima and I imagine that it will only be a matter of time before it is fixed in Mathematica but until that happens why not give this integral to your students and show them that, sometimes at least, they can do calculus better than Mathematica?<\/p>\n<p align=\"left\">\n<p align=\"center\">\n","protected":false},"excerpt":{"rendered":"<p>How good is your symbolic integral calculus? Do you think that you can do better than Mathematica? Let&#8217;s see &#8211; try and evaluate the following (there is a hint in the comments if you get stuck). My integration skills are a little rusty but I found the solution, log(6)\/4, without too much difficulty (I have [&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,8],"tags":[],"class_list":["post-49","post","type-post","status-publish","format-standard","hentry","category-general-math","category-mathematica"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3swhs-N","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/49","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=49"}],"version-history":[{"count":4,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions"}],"predecessor-version":[{"id":2262,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions\/2262"}],"wp:attachment":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=49"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=49"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=49"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}