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

public Class IterativeLegendreGaussIntegrator

extends BaseAbstractUnivariateIntegrator
Class Inheritance
Imports
org.apache.commons.math3.analysis.UnivariateFunction, org.apache.commons.math3.analysis.integration.gauss.GaussIntegratorFactory, .GaussIntegrator, org.apache.commons.math3.exception.MathIllegalArgumentException, .MaxCountExceededException, .NotStrictlyPositiveException, .NumberIsTooSmallException, .TooManyEvaluationsException, org.apache.commons.math3.exception.util.LocalizedFormats, org.apache.commons.math3.util.FastMath

This algorithm divides the integration interval into equally-sized sub-interval and on each of them performs a Legendre-Gauss quadrature. Because of its non-adaptive nature, this algorithm can converge to a wrong value for the integral (for example, if the function is significantly different from zero toward the ends of the integration interval). In particular, a change of variables aimed at estimating integrals over infinite intervals as proposed here should be avoided when using this class.
Since
3.1

Field Summary

Modifier and TypeField and Description
private static final GaussIntegratorFactory
FACTORY

Factory that computes the points and weights.

private final int
numberOfPoints

Number of integration points (per interval).

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
IterativeLegendreGaussIntegrator(final int
Number of integration points.
n
,
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.
maximalIterationCount
)

Builds an integrator with given accuracies and iterations counts.

public
IterativeLegendreGaussIntegrator(final int
Number of integration points.
n
,
final double
Relative accuracy of the result.
relativeAccuracy
,
final double
Absolute accuracy of the result.
absoluteAccuracy
)

Builds an integrator with given accuracies.

public
IterativeLegendreGaussIntegrator(final int
Number of integration points.
n
,
final int
Minimum number of iterations.
minimalIterationCount
,
final int
Maximum number of iterations.
maximalIterationCount
)

Builds an integrator with given iteration counts.

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.

private double

Returns:

the value of n-th stage integral.
stage
(final int
Number of steps.
n
)

Compute the n-th stage integral.

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

Field Detail

FACTORYback to summary
private static final GaussIntegratorFactory FACTORY

Factory that computes the points and weights.

numberOfPointsback to summary
private final int numberOfPoints

Number of integration points (per interval).

Constructor Detail

IterativeLegendreGaussIntegratorback to summary
public IterativeLegendreGaussIntegrator(final int n, final double relativeAccuracy, final double absoluteAccuracy, final int minimalIterationCount, final int maximalIterationCount) throws NotStrictlyPositiveException, NumberIsTooSmallException

Builds an integrator with given accuracies and iterations counts.

Parameters
n:int

Number of integration points.

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.

Exceptions
NotStrictlyPositiveException:
if minimal number of iterations or number of points are not strictly positive.
NumberIsTooSmallException:
if maximal number of iterations is smaller than or equal to the minimal number of iterations.
IterativeLegendreGaussIntegratorback to summary
public IterativeLegendreGaussIntegrator(final int n, final double relativeAccuracy, final double absoluteAccuracy) throws NotStrictlyPositiveException

Builds an integrator with given accuracies.

Parameters
n:int

Number of integration points.

relativeAccuracy:double

Relative accuracy of the result.

absoluteAccuracy:double

Absolute accuracy of the result.

Exceptions
NotStrictlyPositiveException:
if n < 1.
IterativeLegendreGaussIntegratorback to summary
public IterativeLegendreGaussIntegrator(final int n, final int minimalIterationCount, final int maximalIterationCount) throws NotStrictlyPositiveException, NumberIsTooSmallException

Builds an integrator with given iteration counts.

Parameters
n:int

Number of integration points.

minimalIterationCount:int

Minimum number of iterations.

maximalIterationCount:int

Maximum number of iterations.

Exceptions
NotStrictlyPositiveException:
  • if minimal number of iterations is not strictly positive.
  • if n < 1.
NumberIsTooSmallException:
if maximal number of iterations is smaller than or equal to the minimal number of iterations.

Method Detail

doIntegrateback to summary
protected double doIntegrate() throws MathIllegalArgumentException, 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
stageback to summary
private double stage(final int n) throws TooManyEvaluationsException

Compute the n-th stage integral.

Parameters
n:int

Number of steps.

Returns:double

the value of n-th stage integral.

Exceptions
TooManyEvaluationsException:
if the maximum number of evaluations is exceeded.