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

public Class GaussIntegratorFactory

extends Object
Class Inheritance
Imports
java.math.BigDecimal, org.apache.commons.math3.exception.DimensionMismatchException, .NotStrictlyPositiveException, org.apache.commons.math3.util.Pair

Class that provides different ways to compute the nodes and weights to be used by the Gaussian integration rule.
Since
3.1

Field Summary

Modifier and TypeField and Description
private final BaseRuleFactory<Double>
hermite

Generator of Gauss-Hermite integrators.

private final BaseRuleFactory<Double>
legendre

Generator of Gauss-Legendre integrators.

private final BaseRuleFactory<BigDecimal>
legendreHighPrecision

Generator of Gauss-Legendre integrators.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static Pair<double[], double[]>

Returns:

the integration nodes and weights.
getRule
(BaseRuleFactory<? extends Number>
Integration rule factory.
factory
,
int
Order of the integration rule.
numberOfPoints
)

public SymmetricGaussIntegrator

Returns:

a Gauss-Hermite integrator.
hermite
(int
Order of the integration rule.
numberOfPoints
)

Creates a Gauss-Hermite integrator of the given order.

public GaussIntegrator

Returns:

a Gauss-Legendre integrator.
legendre
(int
Order of the integration rule.
numberOfPoints
)

Creates a Gauss-Legendre integrator of the given order.

public GaussIntegrator

Returns:

a Gauss-Legendre integrator.
legendre
(int
Order of the integration rule.
numberOfPoints
,
double
Lower bound of the integration interval.
lowerBound
,
double
Upper bound of the integration interval.
upperBound
)

Creates a Gauss-Legendre integrator of the given order.

public GaussIntegrator

Returns:

a Gauss-Legendre integrator.
legendreHighPrecision
(int
Order of the integration rule.
numberOfPoints
)

Creates a Gauss-Legendre integrator of the given order.

public GaussIntegrator

Returns:

a Gauss-Legendre integrator.
legendreHighPrecision
(int
Order of the integration rule.
numberOfPoints
,
double
Lower bound of the integration interval.
lowerBound
,
double
Upper bound of the integration interval.
upperBound
)

Creates an integrator of the given order, and whose call to the integrate method will perform an integration on the given interval.

private static Pair<double[], double[]>

Returns:

the points and weights adapted to the new interval.
transform
(Pair<double[], double[]>
Original points and weights.
rule
,
double
Lower bound of the integration interval.
a
,
double
Lower bound of the integration interval.
b
)

Performs a change of variable so that the integration can be performed on an arbitrary interval [a, b].

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

hermiteback to summary
private final BaseRuleFactory<Double> hermite

Generator of Gauss-Hermite integrators.

legendreback to summary
private final BaseRuleFactory<Double> legendre

Generator of Gauss-Legendre integrators.

legendreHighPrecisionback to summary
private final BaseRuleFactory<BigDecimal> legendreHighPrecision

Generator of Gauss-Legendre integrators.

Constructor Detail

GaussIntegratorFactoryback to summary
public GaussIntegratorFactory()

Method Detail

getRuleback to summary
private static Pair<double[], double[]> getRule(BaseRuleFactory<? extends Number> factory, int numberOfPoints) throws NotStrictlyPositiveException, DimensionMismatchException
Parameters
factory:BaseRuleFactory<? extends Number>

Integration rule factory.

numberOfPoints:int

Order of the integration rule.

Returns:Pair<double[], double[]>

the integration nodes and weights.

Exceptions
NotStrictlyPositiveException:
if number of points is not positive
DimensionMismatchException:
if the elements of the rule pair do not have the same length.
hermiteback to summary
public SymmetricGaussIntegrator hermite(int numberOfPoints)

Creates a Gauss-Hermite integrator of the given order. The call to the integrate method will perform a weighted integration on the interval \([-\infty, +\infty]\): the computed value is the improper integral of \(e^{-x^2}f(x)\) where \(f(x)\) is the function passed to the integrate method.

Parameters
numberOfPoints:int

Order of the integration rule.

Returns:SymmetricGaussIntegrator

a Gauss-Hermite integrator.

legendreback to summary
public GaussIntegrator legendre(int numberOfPoints)

Creates a Gauss-Legendre integrator of the given order. The call to the integrate method will perform an integration on the natural interval [-1 , 1].

Parameters
numberOfPoints:int

Order of the integration rule.

Returns:GaussIntegrator

a Gauss-Legendre integrator.

legendreback to summary
public GaussIntegrator legendre(int numberOfPoints, double lowerBound, double upperBound) throws NotStrictlyPositiveException

Creates a Gauss-Legendre integrator of the given order. The call to the integrate method will perform an integration on the given interval.

Parameters
numberOfPoints:int

Order of the integration rule.

lowerBound:double

Lower bound of the integration interval.

upperBound:double

Upper bound of the integration interval.

Returns:GaussIntegrator

a Gauss-Legendre integrator.

Exceptions
NotStrictlyPositiveException:
if number of points is not positive
legendreHighPrecisionback to summary
public GaussIntegrator legendreHighPrecision(int numberOfPoints) throws NotStrictlyPositiveException

Creates a Gauss-Legendre integrator of the given order. The call to the integrate method will perform an integration on the natural interval [-1 , 1].

Parameters
numberOfPoints:int

Order of the integration rule.

Returns:GaussIntegrator

a Gauss-Legendre integrator.

Exceptions
NotStrictlyPositiveException:
if number of points is not positive
legendreHighPrecisionback to summary
public GaussIntegrator legendreHighPrecision(int numberOfPoints, double lowerBound, double upperBound) throws NotStrictlyPositiveException

Creates an integrator of the given order, and whose call to the integrate method will perform an integration on the given interval.

Parameters
numberOfPoints:int

Order of the integration rule.

lowerBound:double

Lower bound of the integration interval.

upperBound:double

Upper bound of the integration interval.

Returns:GaussIntegrator

a Gauss-Legendre integrator.

Exceptions
NotStrictlyPositiveException:
if number of points is not positive
transformback to summary
private static Pair<double[], double[]> transform(Pair<double[], double[]> rule, double a, double b)

Performs a change of variable so that the integration can be performed on an arbitrary interval [a, b]. It is assumed that the natural interval is [-1, 1].

Parameters
rule:Pair<double[], double[]>

Original points and weights.

a:double

Lower bound of the integration interval.

b:double

Lower bound of the integration interval.

Returns:Pair<double[], double[]>

the points and weights adapted to the new interval.