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
Deprecated.
as of 3.6, this field has been replaced with
incrementCount() |
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.
|
protected void |
incrementCount()
Increment the number of iterations.
|
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
@Deprecated protected Incrementor iterations
incrementCount()
protected BaseAbstractUnivariateIntegrator(double relativeAccuracy, double absoluteAccuracy, int minimalIterationCount, int maximalIterationCount) throws NotStrictlyPositiveException, NumberIsTooSmallException
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 iterationsNotStrictlyPositiveException
- if minimal number of iterations
is not strictly positiveNumberIsTooSmallException
- 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 NotStrictlyPositiveException, NumberIsTooSmallException
minimalIterationCount
- minimum number of iterationsmaximalIterationCount
- maximum number of iterationsNotStrictlyPositiveException
- if minimal number of iterations
is not strictly positiveNumberIsTooSmallException
- 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 void incrementCount() throws MaxCountExceededException
MaxCountExceededException
- if the number of iterations
exceeds the allowed maximum numberprotected double getMin()
protected double getMax()
protected double computeObjectiveValue(double point) throws TooManyEvaluationsException
point
- Point at which the objective function must be evaluated.TooManyEvaluationsException
- if the maximal number of function
evaluations is exceeded.protected void setup(int maxEval, UnivariateFunction f, double lower, double upper) throws NullArgumentException, MathIllegalArgumentException
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 TooManyEvaluationsException, MaxCountExceededException, MathIllegalArgumentException, 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 intervalTooManyEvaluationsException
- if the maximum number of function
evaluations is exceededMaxCountExceededException
- if the maximum iteration count is exceeded
or the integrator detects convergence problems otherwiseMathIllegalArgumentException
- if min > max
or the endpoints do not
satisfy the requirements specified by the integratorNullArgumentException
- if f
is null
.protected abstract double doIntegrate() throws TooManyEvaluationsException, MaxCountExceededException
TooManyEvaluationsException
- if the maximal number of evaluations
is exceeded.MaxCountExceededException
- if the maximum iteration count is exceeded
or the integrator detects convergence problems otherwiseCopyright © 2003–2016 The Apache Software Foundation. All rights reserved.