Boost logo

Boost :

From: Martin Weiser (weiser_at_[hidden])
Date: 2002-10-28 04:06:52

On Montag, 28. Oktober 2002 00:22, Chuck Allison wrote:
> I've been doing adaptive integration for over 20 years. It's the least
> I think a user would expect. Maybe we should compare algorithms.

Comparing algorithms is always interesting. I'd like to draw your
attention, however, to specifying a C++ interface first. The actual
algorithmic realization would then be a "quality of implementation"

Since there seems to be some interest in adaptive integration over
one-dimensional bounded intervals, I'll make a first stab at a possible
interface. This is meant to be the starting point for detailed discussion
and may contain severe errors.

For the evaluation of $\int_a^b f(x) dx$, where $a,b\in\R$ and $f:\R -> B$
($B$ should be a Banach space over the real numbers- maybe even some more
general structure) up to a certain tolerance, the following minimal
interface could be used:

template <class Functor>
typename Functor::result_type
integrate(typename Functor::argument_type a,
          typename Functor::argument_type b,
          Functor f,
          double tol);

The following optional interface extensions may be desirable:
- select between relative and absolute tolerance
- specify known discontinuities
- give a hint for the maximally useful integration order
- select some specific algorithm
- provide a rough estimate on flops per f-evaluation

Maybe this calls for a policy argument.

Several theoretic properties could be made part of the interface by giving
guarantees that the implementation will respect them at least in exact
arithmetic (abbreviated notation):
- linearity: integ(a,b,r*f+s*g) = r*integ(a,b,f)+s*integ(a,b,g)
- symmetry: integ(a,b,f) = -integ(b,a,f)
- additivity: integ(a,b,f) = integ(a,c,f)+integ(c,b,f) (that's tough)
- positivity: integ(a,b,f)>=0 if a<=b and f>=0

Any thoughts?


> ----- Original Message -----
> From: "Gabriel Dos Reis" <gdr_at_[hidden]>

> > Martin Weiser <weiser_at_[hidden]> writes:
> > | It appears to me that many users of such an interface do not have
> > | the experience to select suitable integration points x. And even
> > | the experienced ones may prefer the nodes selected by a carefully
> > | crafted integration code - it's easier to use and the
> > | efficiency/accuracy is probably not worse.
> >
> > Indeed. Adaptive algorithms are known to do a very good job at that
> > most of the time. If a numerical integrator were to made it into
> > Boost, I would expect it to provide for that basic functionality.

Dr. Martin Weiser            Zuse Institute Berlin
weiser_at_[hidden]                Scientific Computing     Numerical Analysis and Modelling

Boost list run by bdawes at, gregod at, cpdaniel at, john at