commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juan Rada-Vilela <>
Subject [math] Resolution of MidPointIntegrator (and others) by powers of two
Date Mon, 12 Sep 2016 21:42:28 GMT

First of all, thanks for such a great library.

I have been looking at the source code of the MidPointIntegrator (and
others), and there is something in particular that got my attention. In
MidPointIntegrator (and others), the first parameter of the method stage
 (namely final int n) defines the resolution of the integrator as a power
of two (2^{n-1}), and the documentation states that it does so "*because
this configuration can best utilize the already computed values*". An
extract of the source code is preseted below and can be found [here]

Could you please elaborate on how does the setting of the resolution to
powers of two best utilize the already computed values? Could you please
provide some references supporting such a claim?

     * Compute the n-th stage integral of midpoint rule.
     * This function should only be called by API
<code>integrate()</code> in the package.
     * To save time it does not verify arguments - caller does.
     * <p>
     * The interval is divided equally into 2^n sections rather than an
     * arbitrary m sections because this configuration can best utilize the
     * already computed values.</p>
     * @param n the stage of 1/2 refinement. Must be larger than 0.
     * @param previousStageResult Result from the previous call to the
     * {@code stage} method.
     * @param min Lower bound of the integration interval.
     * @param diffMaxMin Difference between the lower bound and upper bound
     * of the integration interval.
     * @return the value of n-th stage integral
     * @throws TooManyEvaluationsException if the maximal number of evaluations
     * is exceeded.
    private double stage(final int n,
                         double previousStageResult,
                         double min,
                         double diffMaxMin)
        throws TooManyEvaluationsException {

Many thanks,

<> Juan Rada-Vilela, Ph.D.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message