Re: Is it possible to make NIntegrate faster?
- To: mathgroup at smc.vnet.net
- Subject: [mg105184] Re: Is it possible to make NIntegrate faster?
- From: "michael.p.croucher at googlemail.com" <michael.p.croucher at googlemail.com>
- Date: Tue, 24 Nov 2009 05:45:21 -0500 (EST)
- References: <firstname.lastname@example.org>
On 23 Nov, 11:51, Leo Alekseyev <dnqu... at gmail.com> wrote: > Dear Mathgroup, > > Recently I have been using NIntegrate fairly extensively. I am > dealing with an oscillatory integral that has a singularity. > NIntegrate is able to treat it reasonably well -- the only default I > had to change was increasing MaxRecursion. However, it is slow. 10 > points of my integrand take about 40 seconds to evaluate. After I > ported my code to another system, this same integral took about a second = using > the Gauss-Kronrod method (quadgk in the other system). Furthermore, by > increasing the absolute and relative tolerance values, I could improve > the speed without losing too much precision, so currently the > integrals evaluate in 0.4 seconds. > > I have been playing with various NIntegrate parameters to try to > improve the speed, to no effect. My integrands are straightforward > (although long) algebraic expressions involving a few Bessel functions > and exponentials, wrapped inside a Module; all subexpressions use N > so that nothing should be symbolic... Ideally I hoped to find some > sort of a speed/accuracy tradeoff, but that hasn't happened. > > I read the numerical integration tutorial in the docs, but am finding > it hard to figure out how to improve the efficiency of my integration. > I would expect Mathematica to get to at least within an order of > magnitude of the other system using the same integration strategy. The= current > performance isn't satisfactory -- but neither is the solution of > porting perfectly good Mathematica code to the other system... > > I would much appreciate any suggestions. > > Thanks, > --Leo Hi It's difficult to know what to suggest without seeing the Integrals. Best Wishes, Mike www.walkingrandomly.com