Top Description Fields Constructors Methods
org.apache.commons.math3.analysis.integration

public Class SimpsonIntegrator

extends BaseAbstractUnivariateIntegrator
Class Inheritance
Imports
org.apache.commons.math3.exception.MaxCountExceededException, .NotStrictlyPositiveException, .NumberIsTooLargeException, .NumberIsTooSmallException, .TooManyEvaluationsException, org.apache.commons.math3.util.FastMath

Implements Simpson's Rule for integration of real univariate functions. For reference, see Introduction to Numerical Analysis, ISBN 038795452X, chapter 3.

This implementation employs the basic trapezoid rule to calculate Simpson's rule.

Since
1.2

Field Summary

Modifier and TypeField and Description
public static final int
SIMPSON_MAX_ITERATIONS_COUNT

Maximal number of iterations for Simpson.

Inherited from org.apache.commons.math3.analysis.integration.BaseAbstractUnivariateIntegrator:
DEFAULT_ABSOLUTE_ACCURACYDEFAULT_MAX_ITERATIONS_COUNTDEFAULT_MIN_ITERATIONS_COUNTDEFAULT_RELATIVE_ACCURACYiterations

Constructor Summary

AccessConstructor and Description
public
SimpsonIntegrator(final double
relative accuracy of the result
relativeAccuracy
,
final double
absolute accuracy of the result
absoluteAccuracy
,
final int
minimum number of iterations
minimalIterationCount
,
final int
maximum number of iterations (must be less than or equal to SIMPSON_MAX_ITERATIONS_COUNT)
maximalIterationCount
)

Build a Simpson integrator with given accuracies and iterations counts.

public
SimpsonIntegrator(final int
minimum number of iterations
minimalIterationCount
,
final int
maximum number of iterations (must be less than or equal to SIMPSON_MAX_ITERATIONS_COUNT)
maximalIterationCount
)

Build a Simpson integrator with given iteration counts.

public
SimpsonIntegrator()

Construct an integrator with default settings.

Method Summary

Modifier and TypeMethod and Description
protected double
doIntegrate()

Implements abstract org.apache.commons.math3.analysis.integration.BaseAbstractUnivariateIntegrator.doIntegrate.

Method for implementing actual integration algorithms in derived classes.

Inherited from org.apache.commons.math3.analysis.integration.BaseAbstractUnivariateIntegrator:
computeObjectiveValuegetAbsoluteAccuracygetEvaluationsgetIterationsgetMaxgetMaximalIterationCountgetMingetMinimalIterationCountgetRelativeAccuracyincrementCountintegratesetup

Field Detail

SIMPSON_MAX_ITERATIONS_COUNTback to summary
public static final int SIMPSON_MAX_ITERATIONS_COUNT

Maximal number of iterations for Simpson.

Constructor Detail

SimpsonIntegratorback to summary
public SimpsonIntegrator(final double relativeAccuracy, final double absoluteAccuracy, final int minimalIterationCount, final int maximalIterationCount) throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException

Build a Simpson integrator with given accuracies and iterations counts.

Parameters
relativeAccuracy:double

relative accuracy of the result

absoluteAccuracy:double

absolute accuracy of the result

minimalIterationCount:int

minimum number of iterations

maximalIterationCount:int

maximum number of iterations (must be less than or equal to SIMPSON_MAX_ITERATIONS_COUNT)

Exceptions
NotStrictlyPositiveException:
if minimal number of iterations is not strictly positive
NumberIsTooSmallException:
if maximal number of iterations is lesser than or equal to the minimal number of iterations
NumberIsTooLargeException:
if maximal number of iterations is greater than SIMPSON_MAX_ITERATIONS_COUNT
SimpsonIntegratorback to summary
public SimpsonIntegrator(final int minimalIterationCount, final int maximalIterationCount) throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException

Build a Simpson integrator with given iteration counts.

Parameters
minimalIterationCount:int

minimum number of iterations

maximalIterationCount:int

maximum number of iterations (must be less than or equal to SIMPSON_MAX_ITERATIONS_COUNT)

Exceptions
NotStrictlyPositiveException:
if minimal number of iterations is not strictly positive
NumberIsTooSmallException:
if maximal number of iterations is lesser than or equal to the minimal number of iterations
NumberIsTooLargeException:
if maximal number of iterations is greater than SIMPSON_MAX_ITERATIONS_COUNT
SimpsonIntegratorback to summary
public SimpsonIntegrator()

Construct an integrator with default settings. (max iteration count set to SIMPSON_MAX_ITERATIONS_COUNT)

Method Detail

doIntegrateback to summary
protected double doIntegrate() throws TooManyEvaluationsException, MaxCountExceededException

Implements abstract org.apache.commons.math3.analysis.integration.BaseAbstractUnivariateIntegrator.doIntegrate.

Doc from org.apache.commons.math3.analysis.integration.BaseAbstractUnivariateIntegrator.doIntegrate.

Method for implementing actual integration algorithms in derived classes.

Returns:double

the root.

Annotations
@Override
Exceptions
TooManyEvaluationsException:
if the maximal number of evaluations is exceeded.
MaxCountExceededException:
if the maximum iteration count is exceeded or the integrator detects convergence problems otherwise