[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cquad name change
Re: cquad name change
Thu, 31 Mar 2011 15:57:26 +0100
On Thu, 2011-03-31 at 07:16 -0700, Rik wrote:
> All of the routines which do numerical (QUAD)rature in Octave and Matlab
> begin with the prefix 'quad'. Currently users can type quad<Tab> to see a
> list of possible integration functions. This was more important before
> extensive @seealso links were put in the documentation, but I still suspect
> a routine called 'cquad' would remain undiscovered by most users. On
> reading the documentation for the function I noticed that it uses
> "Clenshaw-Curtis quadrature rules", hence the "cc" suffix. This is in line
> with existing functions like quadgk which implement "Gauss-Konrod quadrature".
You're right, that makes a lot more sense.
> If you would like, we can put in a temporary redirect from 'cquad' to
> 'quadcc' which would throw up a warning message that the function has been
> renamed. This redirect would last for two major releases of Octave (until
Yes, that would be great! This should catch any users coming straight
from the paper.
> I've been meaning to write you about guidance on when to use quadcc.
> General recommendations from the Mathworks for the various quadrature
> routines are:
> The quad function may be most efficient for low accuracies with nonsmooth
> The quadl function may be more efficient than quad at higher accuracies
> with smooth integrands.
> The quadgk function may be most efficient for high accuracies and
> oscillatory integrands. It supports infinite intervals and can handle
> moderate singularities at the endpoints. It also supports contour
> integration along piecewise linear paths.
> I would like to add a similar table to the Octave documentation that helps
> user's pick the most appropriate routine. Is quadcc best for high
> accuracies on non-smooth integrands?
I would suggest quadgk for smooth integrands at intermediate accuracy
(e.g. 1e-6--1e-9) and quadcc for either very low or very high accuracy
and difficult (i.e. non-smooth, discontinuous, oscillatory and/or
singular) integrands, or integrands for which not much is known in
I wouldn't recommend quad (i.e. QUADPACK's DQAGS) for much anything
really. It uses the same local quadrature rules and error estimator as
quadgk, only less efficiently. The only difference is the use of
extrapolation to accelerate convergence of the result. This, however,
can do more harm than good for oscillating or non-smooth integrands. The
problem here, however, would be that too many users will rely on it (and
all its quirks) for historical reasons...
Finally, quadl is just a lower-degree integrator than quadgk and doesn't
group the calls to the integrator, so my guess is that it will always be
slower, except perhaps when the integrand is piecewise linear or just
very discontinuous. It is, again however, interesting for historical
I base these opinions on the results in the TOMS paper and other tests I
did with quadgk (see attached file). According to those results,
Espelid's da2glob should be more robust than quadgk, but it's slower
(doesn't group calls to the integrand) and as far as I know it hasn't
explicitly been ported to Octave (yet?).
Description: Adobe PDF document