{"id":3419,"date":"2012-03-30T08:12:09","date_gmt":"2012-03-30T13:12:09","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=3419"},"modified":"2012-03-30T08:13:21","modified_gmt":"2012-03-30T13:13:21","slug":"archimedess-computation-of-pi","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2012\/03\/30\/archimedess-computation-of-pi\/","title":{"rendered":"Archimedes&#8217;s Computation of Pi"},"content":{"rendered":"<div xmlns:mwsh=\"https:\/\/www.mathworks.com\/namespace\/mcode\/v1\/syntaxhighlight.dtd\" class=\"content\">\r\n   <introduction><\/introduction>\r\n   <p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/911\">Brett<\/a>'s Pick this week is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/29504-the-computation-of-pi-by-archimedes\">The Computation of Pi by Archimedes,<\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/117137\">Bill McKeeman<\/a>.\r\n   <\/p>\r\n   <p>In the comments to Bill's post, long-time File Exchange champion John D'Errico wrote: \"There are two uses for the File Exchange\r\n      that I love. One is to provide high quality code. The second is to teach others about some interesting part of mathematics\r\n      and hopefully, write it using well written MATLAB code. This submission eminently qualifies. You can read it and learn something\r\n      from what Bill has done.\"\r\n   <\/p>\r\n   <p>I wholeheartedly agree with John about the value of Bill's post. In this submission, retired MathWorks Fellow (and current\r\n      (?) Dartmouth adjunct faculty member) Bill provides a beautifully presented explanation of Archimedes's attempt to measure\r\n      pi by calculating the circumferences of regularly polygons bounding the inside and outside of a circle:\r\n   <\/p>\r\n   <p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/pick\/files\/HexPi.jpg\"> <\/p>\r\n   <p>Then, by successively increasing the number of sides of those polygons, Archimedes iterated to a more accurate value of pi\r\n      than had been obtained to date.\r\n   <\/p>\r\n   <p>Besides making a fascinating read, Bill's presentation of this material provides a really nice demonstration of using HTML\r\n      to show mathematics-intensive text. Once rendered using MATLAB's built-in <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2012a\/techdoc\/matlab_env\/f6-30186.html\">publishing<\/a> capabilities, you end up with a <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/29504-the-computation-of-pi-by-archimedes-the-computation-of-pi-by-archimedes\/content\/html\/ComputationOfPiByArchimedes.html\">beautifully formatted report<\/a>.\r\n   <\/p>\r\n   <p>As always, <a href=\"https:\/\/blogs.mathworks.com\/pick\/?p=3419#respond\">comments to this blog post<\/a> are welcome. Or leave a comment for Bill <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/29504-the-computation-of-pi-by-archimedes#comments\">here<\/a>.\r\n   <\/p><script language=\"JavaScript\">\r\n<!--\r\n\r\n    function grabCode_31077bdbf524431e9bff42db78627675() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='31077bdbf524431e9bff42db78627675 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 31077bdbf524431e9bff42db78627675';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        author = 'Brett Shoelson';\r\n        copyright = 'Copyright 2012 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add author and copyright lines at the bottom if specified.\r\n        if ((author.length > 0) || (copyright.length > 0)) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (author.length > 0) {\r\n                d.writeln('% _' + author + '_');\r\n            }\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n      \r\n      d.title = title + ' (MATLAB code)';\r\n      d.close();\r\n      }   \r\n      \r\n-->\r\n<\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_31077bdbf524431e9bff42db78627675()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n            the MATLAB code \r\n            <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; 7.14<br><\/p>\r\n<\/div>\r\n<!--\r\n31077bdbf524431e9bff42db78627675 ##### SOURCE BEGIN #####\r\n%% Archimedes's Computation of Pi\r\n%% \r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/911 Brett>'s Pick this week is\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/29504-the-computation-of-pi-by-archimedes The Computation of Pi by Archimedes,> by \r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/117137 Bill McKeeman>.\r\n\r\n%%\r\n% In the comments to Bill's post, long-time File Exchange\r\n% champion John D'Errico wrote: \"There are two uses for the\r\n% File Exchange that I love. One is to provide high quality\r\n% code. The second is to teach others about some interesting\r\n% part of mathematics and hopefully, write it using well\r\n% written MATLAB code. This submission eminently qualifies.\r\n% You can read it and learn something from what Bill has\r\n% done.\"\r\n\r\n%%\r\n% I wholeheartedly agree with John about the value of Bill's\r\n% post. In this submission, retired MathWorks Fellow (and\r\n% current (?) Dartmouth adjunct faculty member) Bill provides\r\n% a beautifully presented explanation of Archimedes's\r\n% attempt to measure pi by calculating the circumferences\r\n% of regularly polygons bounding the inside and outside of a\r\n% circle:\r\n\r\n%%\r\n% \r\n% <<https:\/\/blogs.mathworks.com\/pick\/files\/HexPi.jpg>>\r\n% \r\n\r\n%%\r\n% Then, by successively increasing the number of\r\n% sides of those polygons, Archimedes iterated to a more\r\n% accurate value of pi than had been obtained to date.\r\n\r\n%%\r\n% Besides making a fascinating read, Bill's presentation of\r\n% this material provides a really nice demonstration of\r\n% using HTML to show mathematics-intensive text. Once\r\n% rendered using MATLAB's built-in <https:\/\/www.mathworks.com\/help\/releases\/R2012a\/techdoc\/matlab_env\/f6-30186.html publishing> capabilities, you end up\r\n% with a <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/29504-the-computation-of-pi-by-archimedes-the-computation-of-pi-by-archimedes\/content\/html\/ComputationOfPiByArchimedes.html beautifully formatted report>.\r\n\r\n%% \r\n% As always, <https:\/\/blogs.mathworks.com\/pick\/?p=3419#respond comments to this blog post> are welcome. Or leave a\r\n% comment for Bill\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/29504-the-computation-of-pi-by-archimedes#comments here>.\r\n##### SOURCE END ##### 31077bdbf524431e9bff42db78627675\r\n-->","protected":false},"excerpt":{"rendered":"<p>\r\n   \r\n   Brett's Pick this week is The Computation of Pi by Archimedes, by Bill McKeeman.\r\n   \r\n   In the comments to Bill's post, long-time File Exchange champion John D'Errico wrote: \"There are... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2012\/03\/30\/archimedess-computation-of-pi\/\">read more >><\/a><\/p>","protected":false},"author":34,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/3419"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/34"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=3419"}],"version-history":[{"count":15,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/3419\/revisions"}],"predecessor-version":[{"id":3437,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/3419\/revisions\/3437"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=3419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=3419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=3419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}