Skip to main content
21 events
when toggle format what by license comment
Aug 9, 2016 at 20:38 comment added bbgodfrey Wonderful! Many thanks.
Aug 8, 2016 at 16:00 comment added Michael E2 @bbgodfrey Done. And then some. :) Perhaps overkill. But in fact, I sometimes find it easier to locate my code by searching SE than searching my computer.
Aug 8, 2016 at 15:58 history edited Michael E2 CC BY-SA 3.0
Responded to comment
Aug 7, 2016 at 13:24 comment added bbgodfrey If you have the time, please consolidate your and @J.M. 's comments into your answer. This discussion is highly informative and may have broad interest. By the way, I am surprised that my answer, although slow, is accurate well beyond what I would have expected.
Aug 7, 2016 at 11:51 comment added J. M.'s missing motivation That's actually sort of expected; GK has a (theoretically) higher degree of exactness than CC. The surprise is that CC is actually able to hold its own, which is what Trefethen puzzled out in that paper.
Aug 7, 2016 at 11:45 comment added Michael E2 @J.M. Yes. It still seems GK often edges out CC, even if the orders of convergence are similar.
Aug 7, 2016 at 11:44 comment added J. M.'s missing motivation @Michael, have you seen this?
Aug 7, 2016 at 11:34 comment added Michael E2 (@Erdem you might be interested in the previous comment, too.) This plot from here, which is roughly equivalent to a typical plot of the error |a[n]| vs. points n for an analytic function, illustrates what I mean. Exponential convergence starts for n > 12 and continues until machine precision is reached.
Aug 7, 2016 at 11:23 comment added Michael E2 @bbgodfrey Another thing - it might even be a rule of thumb - I've noticed: The Gauss-Kronrod (& Clenshaw-Curtis) rule converges exponentially as the number of "Points" increases for analytic functions ("analytic" = "equals its power series"). The default setting often is not high enough to reach exponential convergence for a given integrand. Frequently for analytic functions, doubling the setting to "Points" -> 9 or 11 improves the performance. (By habit, I pick odd numbers. In fact you can halve the time by setting "Points" -> 2 for z & w above & get the same answer.)
Aug 7, 2016 at 10:25 comment added J. M.'s missing motivation @Erdem, to be frank, when you have a multiple integral like yours, that is really no longer considered "simple".
Aug 7, 2016 at 10:00 vote accept Erdem
Aug 7, 2016 at 10:00 comment added Erdem Thank you for the answer. As I aspected even though the question really simple. It does require quite time investment to obtain a good result. In this case it is easy because you have an analytical solution. The way I look is taking a "simple" integral should not require this much of detailed inputs.
Aug 7, 2016 at 2:13 history edited Michael E2 CC BY-SA 3.0
Fixed typo
Aug 7, 2016 at 2:01 history edited Michael E2 CC BY-SA 3.0
Fixed typos
Aug 7, 2016 at 1:52 comment added Michael E2 Oops, I meant "MaxRecursion -> 0 overrides it", of course.
Aug 7, 2016 at 1:47 comment added Michael E2 ...The default for "GaussKronrodRule" has "Points" -> 5, which has 11 sample points (per dimension) and gives a rule of order 17 (zero error up to degree 17), so it probably needs a few recursive subdivisions to reach the desired precision (at least in the x and y dimensions, given the overestimation of the error).
Aug 7, 2016 at 1:41 comment added Michael E2 @bbgodfrey The default (Automatic) "MultidimensionalRule" does rather sparse sampling with poor accuracy - a compromise between speed and accuracy. (For a high dimensional integral, most are satisfied with a few digits of precision.) OTOH, the "CartesianRule", which is also invoked in your Method -> "GaussKronrodRule" (+1, btw), uses a tensor-product grid. This is expensive, but it can be effective, if recursion can be minimized or avoided. By increasing "Points", it can be avoided, except that the error estimator overestimates the error. MaxRecursion -> 1 overrides it....
Aug 7, 2016 at 0:34 comment added bbgodfrey MaxRecursion -> 0 (as opposed to MaxRecursion -> Automatic) seems to play a large role the reduced run time of your two solutions. This would seem to suggest that NIntegrate performs many more recursions than needed. What are your thoughts? In any case, very nice analysis. (+1)
Aug 7, 2016 at 0:09 history edited Michael E2 CC BY-SA 3.0
added 4 characters in body
Aug 6, 2016 at 23:47 history edited Michael E2 CC BY-SA 3.0
added 910 characters in body
Aug 6, 2016 at 22:09 history answered Michael E2 CC BY-SA 3.0