Class RombergIntegrator
- java.lang.Object
-
- org.apache.commons.math4.legacy.analysis.integration.BaseAbstractUnivariateIntegrator
-
- org.apache.commons.math4.legacy.analysis.integration.RombergIntegrator
-
- All Implemented Interfaces:
UnivariateIntegrator
public class RombergIntegrator extends BaseAbstractUnivariateIntegrator
Implements the Romberg Algorithm for integration of real univariate functions. For reference, see Introduction to Numerical Analysis, ISBN 038795452X, chapter 3.Romberg integration employs k successive refinements of the trapezoid rule to remove error terms less than order O(N^(-2k)). Simpson's rule is a special case of k = 2.
- Since:
- 1.2
-
-
Field Summary
Fields Modifier and Type Field Description static int
ROMBERG_MAX_ITERATIONS_COUNT
Maximal number of iterations for Romberg.-
Fields inherited from class org.apache.commons.math4.legacy.analysis.integration.BaseAbstractUnivariateIntegrator
DEFAULT_ABSOLUTE_ACCURACY, DEFAULT_MAX_ITERATIONS_COUNT, DEFAULT_MIN_ITERATIONS_COUNT, DEFAULT_RELATIVE_ACCURACY, iterations
-
-
Constructor Summary
Constructors Constructor Description RombergIntegrator()
Construct a Romberg integrator with default settings (max iteration count set toROMBERG_MAX_ITERATIONS_COUNT
).RombergIntegrator(double relativeAccuracy, double absoluteAccuracy, int minimalIterationCount, int maximalIterationCount)
Build a Romberg integrator with given accuracies and iterations counts.RombergIntegrator(int minimalIterationCount, int maximalIterationCount)
Build a Romberg integrator with given iteration counts.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
doIntegrate()
Method for implementing actual integration algorithms in derived classes.-
Methods inherited from class org.apache.commons.math4.legacy.analysis.integration.BaseAbstractUnivariateIntegrator
computeObjectiveValue, getAbsoluteAccuracy, getEvaluations, getIterations, getMax, getMaximalIterationCount, getMin, getMinimalIterationCount, getRelativeAccuracy, integrate, setup
-
-
-
-
Field Detail
-
ROMBERG_MAX_ITERATIONS_COUNT
public static final int ROMBERG_MAX_ITERATIONS_COUNT
Maximal number of iterations for Romberg.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RombergIntegrator
public RombergIntegrator(double relativeAccuracy, double absoluteAccuracy, int minimalIterationCount, int maximalIterationCount)
Build a Romberg integrator with given accuracies and iterations counts.- Parameters:
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 toROMBERG_MAX_ITERATIONS_COUNT
)- Throws:
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 thanROMBERG_MAX_ITERATIONS_COUNT
-
RombergIntegrator
public RombergIntegrator(int minimalIterationCount, int maximalIterationCount)
Build a Romberg integrator with given iteration counts.- Parameters:
minimalIterationCount
- minimum number of iterationsmaximalIterationCount
- maximum number of iterations (must be less than or equal toROMBERG_MAX_ITERATIONS_COUNT
)- Throws:
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 thanROMBERG_MAX_ITERATIONS_COUNT
-
RombergIntegrator
public RombergIntegrator()
Construct a Romberg integrator with default settings (max iteration count set toROMBERG_MAX_ITERATIONS_COUNT
).
-
-
Method Detail
-
doIntegrate
protected double doIntegrate()
Method for implementing actual integration algorithms in derived classes.- Specified by:
doIntegrate
in classBaseAbstractUnivariateIntegrator
- Returns:
- the root.
-
-