Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to implement a numerical integrator that should have the minimum relative error and is not slow. So I was looking for the best accepted state-of-the-art algorithm to do so but there seems to be so many approaches that I could not understand which one should I choose. So I'm turning to you for a recommendation.

Thank you for your attention,

share|cite|improve this question
I suggest you try adaptive quadrature. – lhf Apr 17 '12 at 12:30
There is no such thing as "one algorithm to evaluate them all". Methods for "nice integrals" are quite different from methods for, say, infinite oscillatory integrals, or Cauchy principal value integrals. That's why there are a lot of algorithms, since families of integrals might carry their own unique set of difficulties. – J. M. Apr 17 '12 at 12:31
Yes, and that is precisely the route taken by packages like QUADPACK... – J. M. Apr 17 '12 at 13:10
Offhand: check for singularities. Improper integrals often require special methods. Functions with rapidly decaying or very oscillatory factors also need special treatment. Discontinuous functions require splitting at discontinuities. Everything else is fair game for adaptive quadrature. – J. M. Apr 17 '12 at 13:37
Well, not my fault that you weren't specific at the outset, no? Efficient cubature methods remain an active area of research, and unless you have the expertise, I caution against rolling out your own implementation. You will want to look at the work already done by Ronald Cools and Terje Espelid. – J. M. Apr 17 '12 at 13:47

As @J.M noted, there are many methods, each suited for a certain purpose. If you don't know what the function are in advance, then for low-dimensional ($d < 3$) integrals a adaptive Gauss–Kronrod rule quadrature is probably the fastest.

In higher dimensions, you can really only use Monte-Carlo methods.

If know apriori that the functions have a very large range, you can use a weighted Monte-Carlo approach, in which you select more points in the "large" regions, than in the "smaller" ones.

share|cite|improve this answer
Double-exponential quadrature is claimed to be competitive with adaptive Gauss-Kronrod for "smooth enough" integrals, or integrals with endpoint singularities that aren't too "wild". I haven't done tests myself to confirm this, but I'm putting it out here in case somebody's inclined to play around a bit. – J. M. Apr 17 '12 at 13:06
@J.M - Thanks for the info, I wasn't familiar with that method. The Wiki article claims that "Tanh-sinh quadrature is less efficient than Gaussian quadrature for smooth integrands, but unlike Gaussian quadrature tends to work equally well with integrands having singularities or infinite derivatives at one or both endpoints of the integration interval." – nbubis Apr 17 '12 at 13:40
In any case, if the OP wants $d > 3$, neither of these will work. – nbubis Apr 17 '12 at 13:42
Right, cubature is a different can of worms. There is Genz-Malik and a number of other multidimensional methods for a very restricted class of multiple integrals, but indeed as you say, (quasi-)Monte Carlo is something to be contented with for most problems. – J. M. Apr 17 '12 at 13:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.