org.apache.commons.math3.analysis.integration.gauss
Class GaussIntegrator

java.lang.Object
  extended by org.apache.commons.math3.analysis.integration.gauss.GaussIntegrator

public class GaussIntegrator
extends Object

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

Since:
3.1
Version:
$Id: GaussIntegrator.java 7721 2013-02-14 14:07:13Z CardosoP $

Constructor Summary
GaussIntegrator(double[] points, double[] weights)
          Creates an integrator from the given points and weights.
GaussIntegrator(Pair<double[],double[]> pointsAndWeights)
          Creates an integrator from the given pair of points (first element of the pair) and weights (second element of the pair.
 
Method Summary
 int getNumberOfPoints()
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GaussIntegrator

public GaussIntegrator(double[] points,
                       double[] weights)
                throws NonMonotonicSequenceException
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 - Integration points.
weights - Weights of the corresponding integration nodes.
Throws:
NonMonotonicSequenceException - if the points are not sorted in increasing order.

GaussIntegrator

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 - Integration points and corresponding weights.
Throws:
NonMonotonicSequenceException - if the points are not sorted in increasing order.
See Also:
GaussIntegrator(double[], double[])
Method Detail

integrate

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 - Function to integrate.
Returns:
the integral of the weighted function.

getNumberOfPoints

public int getNumberOfPoints()
Returns:
the order of the integration rule (the number of integration points).


Copyright © 2017 CNES. All Rights Reserved.