Class FieldGaussIntegrator<T extends CalculusFieldElement<T>>
- java.lang.Object
-
- org.hipparchus.analysis.integration.gauss.FieldGaussIntegrator<T>
-
- Type Parameters:
T
- Type of the field elements.
- Direct Known Subclasses:
SymmetricFieldGaussIntegrator
public class FieldGaussIntegrator<T extends CalculusFieldElement<T>> extends Object
Class that implements the Gaussian rule forintegrating
a weighted function.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description FieldGaussIntegrator(Pair<T[],T[]> pointsAndWeights)
Creates an integrator from the given pair of points (first element of the pair) and weights (second element of the pair.FieldGaussIntegrator(T[] points, T[] weights)
Creates an integrator from the givenpoints
andweights
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getNumberOfPoints()
Get order of the integration rule.T
getPoint(int index)
Gets the integration point at the given index.T
getWeight(int index)
Gets the weight of the integration point at the given index.T
integrate(CalculusFieldUnivariateFunction<T> f)
Returns an estimate of the integral off(x) * w(x)
, wherew
is a weight function that depends on the actual flavor of the Gauss integration scheme.
-
-
-
Constructor Detail
-
FieldGaussIntegrator
public FieldGaussIntegrator(T[] points, T[] weights) throws MathIllegalArgumentException
Creates an integrator from the givenpoints
andweights
. The integration interval is defined by the first and last value ofpoints
which must be sorted in increasing order.- Parameters:
points
- Integration points.weights
- Weights of the corresponding integration nodes.- Throws:
MathIllegalArgumentException
- if thepoints
are not sorted in increasing order.MathIllegalArgumentException
- if points and weights don't have the same length
-
FieldGaussIntegrator
public FieldGaussIntegrator(Pair<T[],T[]> pointsAndWeights) throws MathIllegalArgumentException
Creates an integrator from the given pair of points (first element of the pair) and weights (second element of the pair.- Parameters:
pointsAndWeights
- Integration points and corresponding weights.- Throws:
MathIllegalArgumentException
- if thepoints
are not sorted in increasing order.- See Also:
FieldGaussIntegrator(CalculusFieldElement[], CalculusFieldElement[])
-
-
Method Detail
-
integrate
public T integrate(CalculusFieldUnivariateFunction<T> f)
Returns an estimate of the integral off(x) * w(x)
, wherew
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 theconstructor
.- Parameters:
f
- Function to integrate.- Returns:
- the integral of the weighted function.
-
getNumberOfPoints
public int getNumberOfPoints()
Get order of the integration rule.- Returns:
- the order of the integration rule (the number of integration points).
-
getPoint
public T 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
- index of the integration point- Returns:
- the integration point.
-
getWeight
public T 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
- index of the integration point- Returns:
- the weight.
-
-