Hello,

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]
<https://git-wip-us.apache.org/repos/asf?p=commons-math.git;a=blob;f=src/main/java/org/apache/commons/math4/analysis/integration/MidPointIntegrator.java;h=edcb3007c2936a913419e2cd7e058cc97a3bf443;hb=refs/heads/develop#l98>

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,

<http://www.fuzzylite.com/> Juan Rada-Vilela, Ph.D.
jcr...@fuzzylite.com
http://www.fuzzylite.com/jcrada

Reply via email to