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

public Class GaussIntegrator

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.commons.math3.analysis.integration.gauss.SymmetricGaussIntegrator
Imports
org.apache.commons.math3.analysis.UnivariateFunction, org.apache.commons.math3.exception.DimensionMismatchException, .NonMonotonicSequenceException, org.apache.commons.math3.util.MathArrays, .Pair

Class that implements the Gaussian rule for integrating a weighted function.
Since
3.1

Field Summary

Modifier and TypeField and Description
private final double[]
points

Nodes.

private final double[]
weights

Nodes weights.

Constructor Summary

AccessConstructor and Description
public
GaussIntegrator(double[]
Integration points.
points
,
double[]
Weights of the corresponding integration nodes.
weights
)

Creates an integrator from the given points and weights.

public
GaussIntegrator(Pair<double[], double[]>
Integration points and corresponding weights.
pointsAndWeights
)

Creates an integrator from the given pair of points (first element of the pair) and weights (second element of the pair.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the order of the integration rule (the number of integration points).
getNumberOfPoints
()

public double

Returns:

the integration point.
getPoint
(int
index of the integration point
index
)

Gets the integration point at the given index.

public double

Returns:

the weight.
getWeight
(int
index of the integration point
index
)

Gets the weight of the integration point at the given index.

public double

Returns:

the integral of the weighted function.
integrate
(UnivariateFunction
Function to integrate.
f
)

Returns an estimate of the integral of f(x) * w(x), where w is a weight function that depends on the actual flavor of the Gauss integration scheme.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

pointsback to summary
private final double[] points

Nodes.

weightsback to summary
private final double[] weights

Nodes weights.

Constructor Detail

GaussIntegratorback to summary
public GaussIntegrator(double[] points, double[] weights) throws NonMonotonicSequenceException, DimensionMismatchException

Creates an integrator from the given points and weights. The integration interval is defined by the first and last value of points which must be sorted in increasing order.

Parameters
points:double[]

Integration points.

weights:double[]

Weights of the corresponding integration nodes.

Exceptions
NonMonotonicSequenceException:
if the points are not sorted in increasing order.
DimensionMismatchException:
if points and weights don't have the same length
GaussIntegratorback to summary
public GaussIntegrator(Pair<double[], double[]> pointsAndWeights) throws NonMonotonicSequenceException

Creates an integrator from the given pair of points (first element of the pair) and weights (second element of the pair.

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

Integration points and corresponding weights.

Exceptions
NonMonotonicSequenceException:
if the points are not sorted in increasing order.
See Also
GaussIntegrator(double[], double[])

Method Detail

getNumberOfPointsback to summary
public int getNumberOfPoints()
Returns:int

the order of the integration rule (the number of integration points).

getPointback to summary
public double getPoint(int index)

Gets the integration point at the given index. The index must be in the valid range but no check is performed.

Parameters
index:int

index of the integration point

Returns:double

the integration point.

getWeightback to summary
public double getWeight(int index)

Gets the weight of the integration point at the given index. The index must be in the valid range but no check is performed.

Parameters
index:int

index of the integration point

Returns:double

the weight.

integrateback to summary
public double integrate(UnivariateFunction f)

Returns an estimate of the integral of f(x) * w(x), where w is a weight function that depends on the actual flavor of the Gauss integration scheme. The algorithm uses the points and associated weights, as passed to the constructor.

Parameters
f:UnivariateFunction

Function to integrate.

Returns:double

the integral of the weighted function.