Class LegendreGaussIntegrator
- All Implemented Interfaces:
UnivariateIntegrator
Legendre-Gauss integrators are efficient integrators that can accurately integrate functions with few function evaluations. A Legendre-Gauss integrator using an n-points quadrature formula can integrate 2n-1 degree polynomials exactly.
These integrators evaluate the function on n carefully chosen abscissas in each step interval (mapped to the canonical [-1,1] interval). The evaluation abscissas are not evenly spaced and none of them are at the interval endpoints. This implies the function integrated can be undefined at integration interval endpoints.
The evaluation abscissas xi are the roots of the degree n Legendre polynomial. The weights ai of the quadrature formula integrals from -1 to +1 ∫ Li2 where Li (x) = ∏ (x-xk)/(xi-xk) for k != i.
- Since:
- 1.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final double[]
Deprecated.Abscissas for the current method.private static final double[]
Deprecated.Abscissas for the 2 points method.private static final double[]
Deprecated.Abscissas for the 3 points method.private static final double[]
Deprecated.Abscissas for the 4 points method.private static final double[]
Deprecated.Abscissas for the 5 points method.private final double[]
Deprecated.Weights for the current method.private static final double[]
Deprecated.Weights for the 2 points method.private static final double[]
Deprecated.Weights for the 3 points method.private static final double[]
Deprecated.Weights for the 4 points method.private static final double[]
Deprecated.Weights for the 5 points method.Fields inherited from class org.apache.commons.math3.analysis.integration.BaseAbstractUnivariateIntegrator
DEFAULT_ABSOLUTE_ACCURACY, DEFAULT_MAX_ITERATIONS_COUNT, DEFAULT_MIN_ITERATIONS_COUNT, DEFAULT_RELATIVE_ACCURACY, iterations
-
Constructor Summary
ConstructorsConstructorDescriptionLegendreGaussIntegrator
(int n, double relativeAccuracy, double absoluteAccuracy) Deprecated.Build a Legendre-Gauss integrator with given accuracies.LegendreGaussIntegrator
(int n, double relativeAccuracy, double absoluteAccuracy, int minimalIterationCount, int maximalIterationCount) Deprecated.Build a Legendre-Gauss integrator with given accuracies and iterations counts.LegendreGaussIntegrator
(int n, int minimalIterationCount, int maximalIterationCount) Deprecated.Build a Legendre-Gauss integrator with given iteration counts. -
Method Summary
Modifier and TypeMethodDescriptionprotected double
Deprecated.Method for implementing actual integration algorithms in derived classes.private double
stage
(int n) Deprecated.Compute the n-th stage integral.Methods inherited from class org.apache.commons.math3.analysis.integration.BaseAbstractUnivariateIntegrator
computeObjectiveValue, getAbsoluteAccuracy, getEvaluations, getIterations, getMax, getMaximalIterationCount, getMin, getMinimalIterationCount, getRelativeAccuracy, incrementCount, integrate, setup
-
Field Details
-
ABSCISSAS_2
private static final double[] ABSCISSAS_2Deprecated.Abscissas for the 2 points method. -
WEIGHTS_2
private static final double[] WEIGHTS_2Deprecated.Weights for the 2 points method. -
ABSCISSAS_3
private static final double[] ABSCISSAS_3Deprecated.Abscissas for the 3 points method. -
WEIGHTS_3
private static final double[] WEIGHTS_3Deprecated.Weights for the 3 points method. -
ABSCISSAS_4
private static final double[] ABSCISSAS_4Deprecated.Abscissas for the 4 points method. -
WEIGHTS_4
private static final double[] WEIGHTS_4Deprecated.Weights for the 4 points method. -
ABSCISSAS_5
private static final double[] ABSCISSAS_5Deprecated.Abscissas for the 5 points method. -
WEIGHTS_5
private static final double[] WEIGHTS_5Deprecated.Weights for the 5 points method. -
abscissas
private final double[] abscissasDeprecated.Abscissas for the current method. -
weights
private final double[] weightsDeprecated.Weights for the current method.
-
-
Constructor Details
-
LegendreGaussIntegrator
public LegendreGaussIntegrator(int n, double relativeAccuracy, double absoluteAccuracy, int minimalIterationCount, int maximalIterationCount) throws MathIllegalArgumentException, NotStrictlyPositiveException, NumberIsTooSmallException Deprecated.Build a Legendre-Gauss integrator with given accuracies and iterations counts.- Parameters:
n
- number of points desired (must be between 2 and 5 inclusive)relativeAccuracy
- relative accuracy of the resultabsoluteAccuracy
- absolute accuracy of the resultminimalIterationCount
- minimum number of iterationsmaximalIterationCount
- maximum number of iterations- Throws:
MathIllegalArgumentException
- if number of points is out of [2; 5]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 iterations
-
LegendreGaussIntegrator
public LegendreGaussIntegrator(int n, double relativeAccuracy, double absoluteAccuracy) throws MathIllegalArgumentException Deprecated.Build a Legendre-Gauss integrator with given accuracies.- Parameters:
n
- number of points desired (must be between 2 and 5 inclusive)relativeAccuracy
- relative accuracy of the resultabsoluteAccuracy
- absolute accuracy of the result- Throws:
MathIllegalArgumentException
- if number of points is out of [2; 5]
-
LegendreGaussIntegrator
public LegendreGaussIntegrator(int n, int minimalIterationCount, int maximalIterationCount) throws MathIllegalArgumentException Deprecated.Build a Legendre-Gauss integrator with given iteration counts.- Parameters:
n
- number of points desired (must be between 2 and 5 inclusive)minimalIterationCount
- minimum number of iterationsmaximalIterationCount
- maximum number of iterations- Throws:
MathIllegalArgumentException
- if number of points is out of [2; 5]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 iterations
-
-
Method Details
-
doIntegrate
protected double doIntegrate() throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededExceptionDeprecated.Method for implementing actual integration algorithms in derived classes.- Specified by:
doIntegrate
in classBaseAbstractUnivariateIntegrator
- Returns:
- the root.
- Throws:
TooManyEvaluationsException
- if the maximal number of evaluations is exceeded.MaxCountExceededException
- if the maximum iteration count is exceeded or the integrator detects convergence problems otherwiseMathIllegalArgumentException
-
stage
Deprecated.Compute the n-th stage integral.- Parameters:
n
- number of steps- Returns:
- the value of n-th stage integral
- Throws:
TooManyEvaluationsException
- if the maximum number of evaluations is exceeded.
-
IterativeLegendreGaussIntegrator
instead.