tag:blogger.com,1999:blog-7056990295646173627.post8482838723313979031..comments2020-06-21T23:45:41.188+01:00Comments on Learning Clojure: Numerical Integration: What is an Integral?John Lawrence Aspdenhttp://www.blogger.com/profile/02587130870181071109noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-7056990295646173627.post-34382291532122041232013-06-26T20:00:53.764+01:002013-06-26T20:00:53.764+01:00Thanks for that - I am finding it very useful sinc...Thanks for that - I am finding it very useful since I am trying to learn Clojure by diving head first into rewriting my thesis projectAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-7056990295646173627.post-57833791260299558612012-04-19T01:10:16.455+01:002012-04-19T01:10:16.455+01:00I know this is a set of posts from almost a year a...I know this is a set of posts from almost a year ago, but I'm baffled by the effort you've expended on an already solved problem. Numerical integration (called quadrature) has been extensively studied since the 19th century. I'm sure there's still work being done on this, but there haven't been a lot of recent advances for 1-D quadrature in recent years.<br /><br />The book _Numerical Recipes_ gives a nice overview of the common methods for numerical integration. This book should be on the bookshelf of every scientist and engineer. Twenty minutes of reading would have saved you quite a bit of work, and probably improved the performance of your method.<br /><br />What you probably wanted was either adaptive Romberg integration, or adaptive Gaussian quadrature. For certain integrands (eg: f(x) exp(-x)), there are other quadrature weighting schemes that converge even faster. Well-behaved integrands also tend to converge smoothly with the number of samples, so most adaptive quadrature code has a polynomial extrapolation step to reduce the number of samples needed for a particular tolerance.<br /><br />Also:<br />1. There's a ton of numerical quadrature (integration) code on netlib.org that's public domain.<br />2. If you can tolerate the GPL, the GNU scientific library implements the standard approaches to these problems.<br />3. There also are a number of commercial packages, some of which are designed to take advantage of hardware acceleration (SIMD stuff)<br /><br />Although it's dependent on the integral, a lot of definite integrals can be rewritten as one of well-studied special functions (gamma, beta, erf/erfc, Ei, the various Bessels, etc.). Specialized algorithms have been developed for all of these, and these algorithms are often significantly faster than doing the numerical integration. Again, _Numerical Recipes_ has a reasonably nice overview of special functions, and netlib.org has a ton of code to calculate them. The GNU Scientific Library is also blessed with a large library of special functions.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7056990295646173627.post-58767430449419791172011-05-26T20:57:56.994+01:002011-05-26T20:57:56.994+01:00You might want to check to sicp videos at http://g...You might want to check to sicp videos at http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/<br /><br />There are several lectures on differentiation that might be useful, and, are fun to watch. There is a lecture that uses approximation, one that rewrites the formula s-expressions, eg (* x x) rewrites to (* 2 x), and a lecture that compiles the basic rules for differentiation to a rewrite-function that can actually do the job.<br /><br />Regards, WalterWalterhttps://www.blogger.com/profile/15105763554520443059noreply@blogger.com