- java.lang.Object
-
- net.finmath.integration.AbstractRealIntegral
-
- net.finmath.integration.TrapezoidalRealIntegrator
-
- All Implemented Interfaces:
RealIntegral
public class TrapezoidalRealIntegrator extends AbstractRealIntegral
A simple integrator using the trapezoidal rule.- Version:
- 1.0
- Author:
- Christian Fries
-
-
Constructor Summary
Constructors Constructor Description TrapezoidalRealIntegrator(double lowerBound, double upperBound, double[] evaluationPoints)
Create an integrator using the trapezoidal rule.TrapezoidalRealIntegrator(double lowerBound, double upperBound, int numberOfEvaluationPoints)
Create an integrator using the trapezoidal rule and an equi-distant grid of evaluation points.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
integrate(DoubleUnaryOperator integrand)
-
Methods inherited from class net.finmath.integration.AbstractRealIntegral
getLowerBound, getUpperBound
-
-
-
-
Constructor Detail
-
TrapezoidalRealIntegrator
public TrapezoidalRealIntegrator(double lowerBound, double upperBound, double[] evaluationPoints)
Create an integrator using the trapezoidal rule.- Parameters:
lowerBound
- Lower bound of the integral.upperBound
- Upper bound of the integral.evaluationPoints
- An ordered array of the inner evaluation points to use.
-
TrapezoidalRealIntegrator
public TrapezoidalRealIntegrator(double lowerBound, double upperBound, int numberOfEvaluationPoints)
Create an integrator using the trapezoidal rule and an equi-distant grid of evaluation points. The minimum number of evaluation points (numberOfEvaluationPoints
) is 2, since the trapezoidal rule operates on intervals. That is, lowerBound and upperBound are always evaluated. FornumberOfEvaluationPoints > 2
additional inner points will be evaluated.- Parameters:
lowerBound
- Lower bound of the integral.upperBound
- Upper bound of the integral.numberOfEvaluationPoints
- Number of evaluation points (that is calls to the applyAsDouble of integrand). Has to be > 2;
-
-
Method Detail
-
integrate
public double integrate(DoubleUnaryOperator integrand)
- Specified by:
integrate
in interfaceRealIntegral
- Specified by:
integrate
in classAbstractRealIntegral
-
-