Re: Is it possible to make NIntegrate faster?
- To: mathgroup at smc.vnet.net
- Subject: [mg105204] Re: [mg105163] Is it possible to make NIntegrate faster?
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Tue, 24 Nov 2009 05:49:14 -0500 (EST)
- References: <200911231150.GAA21785@smc.vnet.net>
- Reply-to: drmajorbob at yahoo.com
You told us everything but what we need to know: the integrand. It may be defined with SetDelayed, where Set could be much faster. There may be other issues. But in a vacuum... who knows? Bobby On Mon, 23 Nov 2009 05:50:40 -0600, Leo Alekseyev <dnquark 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 > -- DrMajorBob at yahoo.com
- References:
- Is it possible to make NIntegrate faster?
- From: Leo Alekseyev <dnquark@gmail.com>
- Is it possible to make NIntegrate faster?