public abstract class BaseAbstractUnivariateIntegrator extends Object implements UnivariateIntegrator
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_ABSOLUTE_ACCURACY
Default absolute accuracy.
|
static int |
DEFAULT_MAX_ITERATIONS_COUNT
Default maximal iteration count.
|
static int |
DEFAULT_MIN_ITERATIONS_COUNT
Default minimal iteration count.
|
static double |
DEFAULT_RELATIVE_ACCURACY
Default relative accuracy.
|
protected Incrementor |
iterations
The iteration count.
|
Modifier | Constructor and Description |
---|---|
protected |
BaseAbstractUnivariateIntegrator(double relativeAccuracy,
double absoluteAccuracy)
Construct an integrator with given accuracies.
|
protected |
BaseAbstractUnivariateIntegrator(double relativeAccuracy,
double absoluteAccuracy,
int minimalIterationCount,
int maximalIterationCount)
Construct an integrator with given accuracies and iteration counts.
|
protected |
BaseAbstractUnivariateIntegrator(int minimalIterationCount,
int maximalIterationCount)
Construct an integrator with given iteration counts.
|
Modifier and Type | Method and Description |
---|---|
protected double |
computeObjectiveValue(double point)
Compute the objective function value.
|
protected abstract double |
doIntegrate()
Method for implementing actual integration algorithms in derived
classes.
|
double |
getAbsoluteAccuracy()
Get the absolute accuracy.
|
int |
getEvaluations()
Get the number of function evaluations of the last run of the integrator.
|
int |
getIterations()
Get the number of iterations of the last run of the integrator.
|
protected double |
getMax() |
int |
getMaximalIterationCount()
Get the upper limit for the number of iterations.
|
protected double |
getMin() |
int |
getMinimalIterationCount()
Get the min limit for the number of iterations.
|
double |
getRelativeAccuracy()
Get the relative accuracy.
|
double |
integrate(int maxEval,
UnivariateFunction f,
double lower,
double upper)
Integrate the function in the given interval.
|
protected void |
setup(int maxEval,
UnivariateFunction f,
double lower,
double upper)
Prepare for computation.
|
public static final double DEFAULT_ABSOLUTE_ACCURACY
public static final double DEFAULT_RELATIVE_ACCURACY
public static final int DEFAULT_MIN_ITERATIONS_COUNT
public static final int DEFAULT_MAX_ITERATIONS_COUNT
protected final Incrementor iterations
protected BaseAbstractUnivariateIntegrator(double relativeAccuracy, double absoluteAccuracy, int minimalIterationCount, int maximalIterationCount) throws MathIllegalArgumentException
The meanings of the various parameters are:
Precision.SAFE_MIN
.relativeAccuracy
- relative accuracy of the resultabsoluteAccuracy
- absolute accuracy of the resultminimalIterationCount
- minimum number of iterationsmaximalIterationCount
- maximum number of iterationsMathIllegalArgumentException
- if minimal number of iterations
is not strictly positiveMathIllegalArgumentException
- if maximal number of iterations
is lesser than or equal to the minimal number of iterationsprotected BaseAbstractUnivariateIntegrator(double relativeAccuracy, double absoluteAccuracy)
relativeAccuracy
- relative accuracy of the resultabsoluteAccuracy
- absolute accuracy of the resultprotected BaseAbstractUnivariateIntegrator(int minimalIterationCount, int maximalIterationCount) throws MathIllegalArgumentException
minimalIterationCount
- minimum number of iterationsmaximalIterationCount
- maximum number of iterationsMathIllegalArgumentException
- if minimal number of iterations
is not strictly positiveMathIllegalArgumentException
- if maximal number of iterations
is lesser than or equal to the minimal number of iterationspublic double getRelativeAccuracy()
getRelativeAccuracy
in interface UnivariateIntegrator
public double getAbsoluteAccuracy()
getAbsoluteAccuracy
in interface UnivariateIntegrator
public int getMinimalIterationCount()
getMinimalIterationCount
in interface UnivariateIntegrator
public int getMaximalIterationCount()
getMaximalIterationCount
in interface UnivariateIntegrator
public int getEvaluations()
getEvaluations
in interface UnivariateIntegrator
public int getIterations()
getIterations
in interface UnivariateIntegrator
protected double getMin()
protected double getMax()
protected double computeObjectiveValue(double point) throws MathIllegalStateException
point
- Point at which the objective function must be evaluated.MathIllegalStateException
- if the maximal number of function
evaluations is exceeded.protected void setup(int maxEval, UnivariateFunction f, double lower, double upper) throws MathIllegalArgumentException, NullArgumentException
solve
methods.maxEval
- Maximum number of evaluations.f
- the integrand functionlower
- the min bound for the intervalupper
- the upper bound for the intervalNullArgumentException
- if f
is null
.MathIllegalArgumentException
- if min >= max
.public double integrate(int maxEval, UnivariateFunction f, double lower, double upper) throws MathIllegalArgumentException, MathIllegalStateException, NullArgumentException
integrate
in interface UnivariateIntegrator
maxEval
- Maximum number of evaluations.f
- the integrand functionlower
- the lower bound for the intervalupper
- the upper bound for the intervalMathIllegalArgumentException
- if min > max
or the endpoints do not
satisfy the requirements specified by the integratorMathIllegalStateException
- if the maximum number of function
evaluations is exceededNullArgumentException
- if f
is null
.protected abstract double doIntegrate() throws MathIllegalStateException
MathIllegalStateException
- if the maximal number of evaluations
is exceeded.MathIllegalStateException
- if the maximum iteration count is exceeded
or the integrator detects convergence problems otherwiseCopyright © 2016-2022 CS GROUP. All rights reserved.