public class MidPointIntegrator extends BaseAbstractUnivariateIntegrator
The function should be integrable.
Modifier and Type | Field and Description |
---|---|
static int |
MIDPOINT_MAX_ITERATIONS_COUNT
Maximum number of iterations for midpoint.
|
DEFAULT_ABSOLUTE_ACCURACY, DEFAULT_MAX_ITERATIONS_COUNT, DEFAULT_MIN_ITERATIONS_COUNT, DEFAULT_RELATIVE_ACCURACY, iterations
Constructor and Description |
---|
MidPointIntegrator()
Construct a midpoint integrator with default settings.
|
MidPointIntegrator(double relativeAccuracy,
double absoluteAccuracy,
int minimalIterationCount,
int maximalIterationCount)
Build a midpoint integrator with given accuracies and iterations counts.
|
MidPointIntegrator(int minimalIterationCount,
int maximalIterationCount)
Build a midpoint integrator with given iteration counts.
|
Modifier and Type | Method and Description |
---|---|
protected double |
doIntegrate()
Method for implementing actual integration algorithms in derived
classes.
|
private double |
stage(int n,
double previousStageResult,
double min,
double diffMaxMin)
Compute the n-th stage integral of midpoint rule.
|
computeObjectiveValue, getAbsoluteAccuracy, getEvaluations, getIterations, getMax, getMaximalIterationCount, getMin, getMinimalIterationCount, getRelativeAccuracy, integrate, setup
public static final int MIDPOINT_MAX_ITERATIONS_COUNT
public MidPointIntegrator(double relativeAccuracy, double absoluteAccuracy, int minimalIterationCount, int maximalIterationCount) throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException
relativeAccuracy
- relative accuracy of the resultabsoluteAccuracy
- absolute accuracy of the resultminimalIterationCount
- minimum number of iterationsmaximalIterationCount
- maximum number of iterations
(must be less than or equal to MIDPOINT_MAX_ITERATIONS_COUNT
NotStrictlyPositiveException
- if minimal number of iterations
is not strictly positiveNumberIsTooSmallException
- if maximal number of iterations
is lesser than or equal to the minimal number of iterationsNumberIsTooLargeException
- if maximal number of iterations
is greater than MIDPOINT_MAX_ITERATIONS_COUNT
public MidPointIntegrator(int minimalIterationCount, int maximalIterationCount) throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException
minimalIterationCount
- minimum number of iterationsmaximalIterationCount
- maximum number of iterations
(must be less than or equal to MIDPOINT_MAX_ITERATIONS_COUNT
NotStrictlyPositiveException
- if minimal number of iterations
is not strictly positiveNumberIsTooSmallException
- if maximal number of iterations
is lesser than or equal to the minimal number of iterationsNumberIsTooLargeException
- if maximal number of iterations
is greater than MIDPOINT_MAX_ITERATIONS_COUNT
public MidPointIntegrator()
MIDPOINT_MAX_ITERATIONS_COUNT
)private double stage(int n, double previousStageResult, double min, double diffMaxMin) throws TooManyEvaluationsException
integrate()
in the package.
To save time it does not verify arguments - caller does.
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.
n
- the stage of 1/2 refinement. Must be larger than 0.previousStageResult
- Result from the previous call to the
stage
method.min
- Lower bound of the integration interval.diffMaxMin
- Difference between the lower bound and upper bound
of the integration interval.TooManyEvaluationsException
- if the maximal number of evaluations
is exceeded.protected double doIntegrate() throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededException
doIntegrate
in class BaseAbstractUnivariateIntegrator
TooManyEvaluationsException
- if the maximal number of evaluations
is exceeded.MaxCountExceededException
- if the maximum iteration count is exceeded
or the integrator detects convergence problems otherwiseMathIllegalArgumentException
Copyright (c) 2003-2016 Apache Software Foundation